class InboundEstablishState2 extends InboundEstablishState implements SSU2Payload.PayloadCallback
InboundEstablishState.InboundState_aliceIP, _alicePort, _bobIP, _bobPort, _context, _createdSentCount, _currentState, _establishBegin, _introductionRequested, _lastSend, _log, _nextSend, _receivedConfirmedIdentity, _receivedUnconfirmedIdentity, _remoteHostId, _rtt, _sentRelayTag, RETRANSMIT_DELAY| Constructor and Description |
|---|
InboundEstablishState2(RouterContext ctx,
UDPTransport transport,
UDPPacket packet)Start a new handshake with the given incoming packet,
which must be a Session Request or Token Request. |
| Modifier and Type | Method and Description |
|---|---|
void | createdPacketSent()createdPacketSent. |
void | createdPacketSent(DatagramPacket pkt)note that we just sent the SessionCreated packet
and save it for retransmission |
void | fail()Overridden to destroy the handshake state |
HandshakeState | getHandshakeState() |
EstablishmentManager.Token | getNextToken() |
PeerState2 | getPeerState() |
long | getRcvConnID() |
byte[] | getRcvHeaderEncryptKey1() |
byte[] | getRcvHeaderEncryptKey2() |
UDPPacket | getRetransmitSessionCreatedPacket() |
long | getSendConnID() |
byte[] | getSendHeaderEncryptKey1() |
byte[] | getSendHeaderEncryptKey2() |
InetSocketAddress | getSentAddress() |
long | getToken() |
int | getVersion()Return the SSU protocol version for this state (always 1 for SSU1). |
void | gotACK(long ackThru,
int acks,
byte[] ranges)gotACK. |
void | gotAddress(byte[] ip,
int port)gotAddress. |
void | gotDateTime(long time)gotDateTime. |
void | gotFragment(byte[] data,
int off,
int len,
long messageID,
int frag,
boolean isLast)gotFragment. |
void | gotI2NP(I2NPMessage msg)gotI2NP. |
void | gotOptions(byte[] options,
boolean isHandshake)gotOptions. |
void | gotPathChallenge(RemoteHostId from,
byte[] data)gotPathChallenge. |
void | gotPathResponse(RemoteHostId from,
byte[] data)gotPathResponse. |
void | gotPeerTest(int msg,
int status,
Hash h,
byte[] data)gotPeerTest. |
void | gotRelayIntro(Hash aliceHash,
byte[] data)gotRelayIntro. |
void | gotRelayRequest(byte[] data)gotRelayRequest. |
void | gotRelayResponse(int status,
byte[] data)gotRelayResponse. |
void | gotRelayTag(long tag)gotRelayTag. |
void | gotRelayTagRequest()gotRelayTagRequest. |
void | gotRI(RouterInfo ri,
boolean isHandshake,
boolean flood)For most errors here we throw a RIException with a reason code,
which is caught in processPayload() to create a PeerStateDestroyed
and send a termination with that reason. |
void | gotRIFragment(byte[] data,
boolean isHandshake,
boolean flood,
boolean isGzipped,
int frag,
int totalFrags)gotRIFragment. |
void | gotTermination(int reason,
long count)gotTermination. |
void | gotToken(long token,
long expires)gotToken. |
void | queuePossibleDataPacket(UDPPacket packet) |
PeerState2 | receiveSessionConfirmed(UDPPacket packet)Receive the last messages in the handshake, and create the PeerState. |
void | receiveSessionOrTokenRequestAfterRetry(UDPPacket packet)All exceptions thrown from here will be fatal. |
void | retryPacketSent()note that we just sent a Retry packet |
String | toString()toString. |
addMessage, complete, confirmedFullyReceived, getConfirmedIdentity, getEstablishBeginTime, getLifetime, getLifetime, getMaxDelay, getNextQueuedMessage, getNextSendTime, getReceivedOurIP, getReceivedX, getRemoteHostId, getRTT, getSentIP, getSentPort, getSentRelayTag, getSentSignedOnTime, getState, isComplete, isIntroductionRequested, packetReceived, sessionRequestReceived, setSentRelayTagpublic InboundEstablishState2(RouterContext ctx, UDPTransport transport, UDPPacket packet) throws GeneralSecurityException
packet - with all header encryption removed,
either a SessionRequest OR a TokenRequest.GeneralSecurityExceptionpublic void createdPacketSent()
createdPacketSent in class InboundEstablishStatepublic void createdPacketSent(DatagramPacket pkt)
public void fail()
fail in class InboundEstablishStatepublic HandshakeState getHandshakeState()
public EstablishmentManager.Token getNextToken()
public PeerState2 getPeerState()
public long getRcvConnID()
public byte[] getRcvHeaderEncryptKey1()
public byte[] getRcvHeaderEncryptKey2()
public UDPPacket getRetransmitSessionCreatedPacket()
public long getSendConnID()
public byte[] getSendHeaderEncryptKey1()
public byte[] getSendHeaderEncryptKey2()
public InetSocketAddress getSentAddress()
public long getToken()
public int getVersion()
InboundEstablishStategetVersion in class InboundEstablishStatepublic void gotACK(long ackThru,
int acks,
byte[] ranges)gotACK in interface SSU2Payload.PayloadCallbackackThru - highest contiguous sequence number acknowledgedacks - number of additional acknowledgments beyond ackThruranges - null if nonepublic void gotAddress(byte[] ip,
int port)gotAddress in interface SSU2Payload.PayloadCallbackip - IP address bytesport - port numberpublic void gotDateTime(long time)
gotDateTime in interface SSU2Payload.PayloadCallbacktime - time in milliseconds since epochpublic void gotFragment(byte[] data,
int off,
int len,
long messageID,
int frag,
boolean isLast)
throws DataFormatExceptiongotFragment in interface SSU2Payload.PayloadCallbackdata - buffer containing fragment dataoff - offset in datalen - length of data to copymessageID - unique message identifierfrag - fragment number (0-based)isLast - whether this is the last fragmentDataFormatExceptionpublic void gotI2NP(I2NPMessage msg)
gotI2NP in interface SSU2Payload.PayloadCallbackmsg - the parsed I2NP messagepublic void gotOptions(byte[] options,
boolean isHandshake)gotOptions in interface SSU2Payload.PayloadCallbackoptions - the option dataisHandshake - true only for message 3 part 2public void gotPathChallenge(RemoteHostId from, byte[] data)
gotPathChallenge in interface SSU2Payload.PayloadCallbackfrom - null if unknownpublic void gotPathResponse(RemoteHostId from, byte[] data)
gotPathResponse in interface SSU2Payload.PayloadCallbackfrom - null if unknownpublic void gotPeerTest(int msg,
int status,
Hash h,
byte[] data)gotPeerTest in interface SSU2Payload.PayloadCallbackmsg - 1-7status - 0 = accept, 1-255 = rejecth - Alice or Charlie hash for msg 2 and 4, null for msg 1, 3, 5-7data - excludes flag, includes signaturepublic void gotRelayIntro(Hash aliceHash, byte[] data)
gotRelayIntro in interface SSU2Payload.PayloadCallbackaliceHash - hash of the introducerdata - excludes flag, includes signaturepublic void gotRelayRequest(byte[] data)
gotRelayRequest in interface SSU2Payload.PayloadCallbackdata - excludes flag, includes signaturepublic void gotRelayResponse(int status,
byte[] data)gotRelayResponse in interface SSU2Payload.PayloadCallbackstatus - 0 = accept, 1-255 = rejectdata - excludes flag, includes signaturepublic void gotRelayTag(long tag)
gotRelayTag in interface SSU2Payload.PayloadCallbacktag - the relay tagpublic void gotRelayTagRequest()
gotRelayTagRequest in interface SSU2Payload.PayloadCallbackpublic void gotRI(RouterInfo ri, boolean isHandshake, boolean flood) throws DataFormatException
gotRI in interface SSU2Payload.PayloadCallbackri - will already be validatedisHandshake - true only for message 3 part 2flood - true if this is a floodfill routerDataFormatExceptionpublic void gotRIFragment(byte[] data,
boolean isHandshake,
boolean flood,
boolean isGzipped,
int frag,
int totalFrags)gotRIFragment in interface SSU2Payload.PayloadCallbackdata - is first gzipped and then fragmentedisHandshake - true only for message 3 part 2flood - true if this is a floodfill routerisGzipped - true if the data is gzippedfrag - fragment number (0-based)totalFrags - total number of fragmentspublic void gotTermination(int reason,
long count)gotTermination in interface SSU2Payload.PayloadCallbackreason - termination reason codecount - in theory could wrap around to negative, but very unlikelypublic void gotToken(long token,
long expires)gotToken in interface SSU2Payload.PayloadCallbacktoken - the token valueexpires - token expiration time in millisecondspublic void queuePossibleDataPacket(UDPPacket packet)
packet - with header still encryptedpublic PeerState2 receiveSessionConfirmed(UDPPacket packet)
public void receiveSessionOrTokenRequestAfterRetry(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityExceptionpublic void retryPacketSent()
public String toString()
toString in class InboundEstablishState