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, MAX_DELAY, 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()
Note that we just sent a SessionCreated packet
|
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() |
void |
gotACK(long ackThru,
int acks,
byte[] ranges) |
void |
gotAddress(byte[] ip,
int port) |
void |
gotDateTime(long time) |
void |
gotFragment(byte[] data,
int off,
int len,
long messageID,
int frag,
boolean isLast)
Data must be copied out in this method.
|
void |
gotI2NP(I2NPMessage msg) |
void |
gotOptions(byte[] options,
boolean isHandshake) |
void |
gotPathChallenge(RemoteHostId from,
byte[] data) |
void |
gotPathResponse(RemoteHostId from,
byte[] data) |
void |
gotPeerTest(int msg,
int status,
Hash h,
byte[] data) |
void |
gotRelayIntro(Hash aliceHash,
byte[] data) |
void |
gotRelayRequest(byte[] data) |
void |
gotRelayResponse(int status,
byte[] data) |
void |
gotRelayTag(long tag) |
void |
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) |
void |
gotTermination(int reason,
long count) |
void |
gotToken(long token,
long expires) |
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() |
addMessage, complete, confirmedFullyReceived, getConfirmedIdentity, getEstablishBeginTime, getLifetime, getLifetime, 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()
InboundEstablishStatecreatedPacketSent 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()
getVersion in class InboundEstablishStatepublic void gotACK(long ackThru,
int acks,
byte[] ranges)
gotACK in interface SSU2Payload.PayloadCallbackranges - null if nonepublic void gotAddress(byte[] ip,
int port)
gotAddress in interface SSU2Payload.PayloadCallbackpublic void gotDateTime(long time)
gotDateTime in interface SSU2Payload.PayloadCallbackpublic void gotFragment(byte[] data,
int off,
int len,
long messageID,
int frag,
boolean isLast)
throws DataFormatException
SSU2Payload.PayloadCallbackgotFragment in interface SSU2Payload.PayloadCallbackoff - offset in datalen - length of data to copyDataFormatExceptionpublic void gotI2NP(I2NPMessage msg)
gotI2NP in interface SSU2Payload.PayloadCallbackpublic void gotOptions(byte[] options,
boolean isHandshake)
gotOptions in interface SSU2Payload.PayloadCallbackisHandshake - 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.PayloadCallbackdata - 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.PayloadCallbackpublic 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 2DataFormatExceptionpublic 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 2public void gotTermination(int reason,
long count)
gotTermination in interface SSU2Payload.PayloadCallbackcount - in theory could wrap around to negative, but very unlikelypublic void gotToken(long token,
long expires)
gotToken in interface SSU2Payload.PayloadCallbackpublic void queuePossibleDataPacket(UDPPacket packet)
packet - with header still encryptedpublic PeerState2 receiveSessionConfirmed(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityExceptionpublic void receiveSessionOrTokenRequestAfterRetry(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityExceptionpublic void retryPacketSent()
public String toString()
toString in class InboundEstablishState