Package net.i2p.router.transport.udp
Class InboundEstablishState
- java.lang.Object
-
- net.i2p.router.transport.udp.InboundEstablishState
-
class InboundEstablishState extends Object
Data for a new connection being established, where the remote peer has initiated the connection with us. In other words, they are Alice and we are Bob. TODO do all these methods need to be synchronized?
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
InboundEstablishState.InboundState
-
Constructor Summary
Constructors Constructor Description InboundEstablishState(RouterContext ctx, byte[] remoteIP, int remotePort, int localPort, DHSessionKeyBuilder dh, UDPPacketReader.SessionRequestReader req)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMessage(OutNetMessage msg)
Queue a message to be sent after the session is established.void
complete()
Notify successful completionvoid
createdPacketSent()
note that we just sent a SessionCreated packetvoid
fail()
void
generateSessionKey()
Generates session key and mac key.SessionKey
getCipherKey()
RouterIdentity
getConfirmedIdentity()
Who is Alice (null if forged/unknown) Note that this isn't really confirmed - see below.long
getEstablishBeginTime()
long
getLifetime()
how long have we been trying to establish this session?SessionKey
getMACKey()
OutNetMessage
getNextQueuedMessage()
Pull from the message queuelong
getNextSendTime()
byte[]
getReceivedOurIP()
byte[]
getReceivedX()
(package private) RemoteHostId
getRemoteHostId()
RemoteHostId, uniquely identifies an attempt(package private) int
getRTT()
byte[]
getSentIP()
what IP do they appear to be on?int
getSentPort()
what port number do they appear to be coming from?long
getSentRelayTag()
Signature
getSentSignature()
long
getSentSignedOnTime()
byte[]
getSentY()
InboundEstablishState.InboundState
getState()
boolean
isComplete()
boolean
isIntroductionRequested()
True (default) if no extended options in session request, or value of flag bit in the extended options.void
prepareSessionCreated()
void
receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf)
Note that while a SessionConfirmed could in theory be fragmented, in practice a RouterIdentity is 387 bytes and a single fragment is 512 bytes max, so it will never be fragmented.void
receiveSessionRequest(UDPPacketReader.SessionRequestReader req)
boolean
sessionRequestReceived()
void
setSentRelayTag(long tag)
String
toString()
-
-
-
Constructor Detail
-
InboundEstablishState
public InboundEstablishState(RouterContext ctx, byte[] remoteIP, int remotePort, int localPort, DHSessionKeyBuilder dh, UDPPacketReader.SessionRequestReader req)
- Parameters:
localPort
- Must be our external port, otherwise the signature of the SessionCreated message will be bad if the external port != the internal port.
-
-
Method Detail
-
getState
public InboundEstablishState.InboundState getState()
-
isComplete
public boolean isComplete()
- Returns:
- if previously complete
-
complete
public void complete()
Notify successful completion
-
addMessage
public void addMessage(OutNetMessage msg)
Queue a message to be sent after the session is established. This will only happen if we decide to send something during establishment- Since:
- 0.9.2
-
getNextQueuedMessage
public OutNetMessage getNextQueuedMessage()
Pull from the message queue- Returns:
- null if none
- Since:
- 0.9.2
-
receiveSessionRequest
public void receiveSessionRequest(UDPPacketReader.SessionRequestReader req)
-
sessionRequestReceived
public boolean sessionRequestReceived()
-
getReceivedX
public byte[] getReceivedX()
-
getReceivedOurIP
public byte[] getReceivedOurIP()
-
isIntroductionRequested
public boolean isIntroductionRequested()
True (default) if no extended options in session request, or value of flag bit in the extended options.- Since:
- 0.9.24
-
generateSessionKey
public void generateSessionKey() throws DHSessionKeyBuilder.InvalidPublicParameterException
Generates session key and mac key.
-
getCipherKey
public SessionKey getCipherKey()
-
getMACKey
public SessionKey getMACKey()
-
getSentIP
public byte[] getSentIP()
what IP do they appear to be on?
-
getSentPort
public int getSentPort()
what port number do they appear to be coming from?
-
getSentY
public byte[] getSentY()
-
fail
public void fail()
-
getSentRelayTag
public long getSentRelayTag()
-
setSentRelayTag
public void setSentRelayTag(long tag)
-
getSentSignedOnTime
public long getSentSignedOnTime()
-
prepareSessionCreated
public void prepareSessionCreated()
-
getSentSignature
public Signature getSentSignature()
-
createdPacketSent
public void createdPacketSent()
note that we just sent a SessionCreated packet
-
getLifetime
public long getLifetime()
how long have we been trying to establish this session?
-
getEstablishBeginTime
public long getEstablishBeginTime()
-
getNextSendTime
public long getNextSendTime()
- Returns:
- rcv time after receiving a packet (including after constructor), send time + delay after sending a packet
-
getRTT
int getRTT()
-
getRemoteHostId
RemoteHostId getRemoteHostId()
RemoteHostId, uniquely identifies an attempt
-
receiveSessionConfirmed
public void receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf)
Note that while a SessionConfirmed could in theory be fragmented, in practice a RouterIdentity is 387 bytes and a single fragment is 512 bytes max, so it will never be fragmented.
-
getConfirmedIdentity
public RouterIdentity getConfirmedIdentity()
Who is Alice (null if forged/unknown) Note that this isn't really confirmed - see below.
-
-