class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payload.PayloadCallback
| Modifier and Type | Class and Description |
|---|---|
static class |
OutboundEstablishState2.IntroState
Per-introducer introduction states
|
OutboundEstablishState.OutboundState_aliceIP, _alicePort, _bobIP, _bobPort, _context, _currentState, _establishBegin, _lastSend, _log, _nextSend, _receivedRelayTag, _remoteHostId, _remotePeer, _requestSentCount, _requestSentTime, _rtt, RETRANSMIT_DELAY| Constructor and Description |
|---|
OutboundEstablishState2(RouterContext ctx,
UDPTransport transport,
RemoteHostId claimedAddress,
RemoteHostId remoteHostId,
RouterIdentity remotePeer,
boolean needIntroduction,
SessionKey introKey,
RouterAddress ra,
UDPAddress addr)
Prepare to start a new handshake with the given peer.
|
| Modifier and Type | Method and Description |
|---|---|
PeerState2 |
confirmedPacketsSent(UDPPacket[] packets)
note that we just sent the SessionConfirmed packets
and save them for retransmission
|
int |
countIntroducers() |
void |
fail()
Overridden to destroy the handshake state
|
HandshakeState |
getHandshakeState() |
OutboundEstablishState2.IntroState |
getIntroState(Hash h) |
int |
getMTU()
What is the largest packet we can send to the peer?
Only used for Session Confirmed packets.
|
EstablishmentManager.Token |
getNextToken() |
PeerState2 |
getPeerState() |
long |
getRcvConnID() |
byte[] |
getRcvHeaderEncryptKey1() |
byte[] |
getRcvHeaderEncryptKey2() |
byte[] |
getRcvRetryHeaderEncryptKey2() |
UDPPacket |
getRetransmitSessionRequestPacket() |
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) |
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 |
introduced(byte[] ip,
int port,
long token)
After introduction
|
void |
introSent(Hash h)
A relay request was sent to the SSU2 introducer specified
|
(package private) boolean |
receiveHolePunch()
Overridden because we don't have to wait for Relay Response first.
|
void |
receiveRetry(UDPPacket packet) |
void |
receiveSessionCreated(UDPPacket packet) |
void |
requestSent(DatagramPacket pkt)
note that we just sent the SessionRequest packet
and save it for retransmission
|
void |
setIntroState(Hash h,
OutboundEstablishState2.IntroState state)
Set the current state for the SSU2 introducer specified
|
void |
tokenRequestSent(DatagramPacket packet)
Note that we just sent a token request packet.
|
String |
toString() |
boolean |
validateSessionCreated()
Blocking call (run in the establisher thread) to determine if the
session was created properly.
|
addMessage, complete, confirmedPacketsSent, dataReceived, getClaimedAddress, getConfirmedSentTime, getEstablishBeginTime, getIntroKey, getIntroNonce, getIntroSentTime, getLifetime, getLifetime, getNextQueuedMessage, getNextSendTime, getReceivedIP, getReceivedPort, getReceivedRelayTag, getReceivedSignedOnTime, getRemoteAddress, getRemoteHostId, getRemoteIdentity, getRequestSentTime, getRTT, getSentIP, getSentPort, getSentSignedOnTime, getState, introduced, introductionFailed, introSent, isExtendedOptionsAllowed, isFirstMessageOurDSM, needIntroduction, packetReceived, requestSent, setIntroNoncepublic OutboundEstablishState2(RouterContext ctx, UDPTransport transport, RemoteHostId claimedAddress, RemoteHostId remoteHostId, RouterIdentity remotePeer, boolean needIntroduction, SessionKey introKey, RouterAddress ra, UDPAddress addr) throws IllegalArgumentException
claimedAddress - an IP/port based RemoteHostId, or null if unknownremoteHostId - non-null, == claimedAddress if direct, or a hash-based one if indirectremotePeer - must have supported sig typeneedIntroduction - should we ask Bob to be an introducer for us?
ignored unless allowExtendedOptions is trueintroKey - Bob's introduction key, as published in the netdbaddr - non-nullIllegalArgumentExceptionpublic PeerState2 confirmedPacketsSent(UDPPacket[] packets)
public int countIntroducers()
public void fail()
fail in class OutboundEstablishStatepublic HandshakeState getHandshakeState()
public OutboundEstablishState2.IntroState getIntroState(Hash h)
public int getMTU()
public EstablishmentManager.Token getNextToken()
public PeerState2 getPeerState()
public long getRcvConnID()
public byte[] getRcvHeaderEncryptKey1()
public byte[] getRcvHeaderEncryptKey2()
public byte[] getRcvRetryHeaderEncryptKey2()
public UDPPacket getRetransmitSessionRequestPacket()
public long getSendConnID()
public byte[] getSendHeaderEncryptKey1()
public byte[] getSendHeaderEncryptKey2()
public InetSocketAddress getSentAddress()
public long getToken()
public int getVersion()
getVersion in class OutboundEstablishStatepublic 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 introduced(byte[] ip,
int port,
long token)
public void introSent(Hash h)
boolean receiveHolePunch()
receiveHolePunch in class OutboundEstablishStatepublic void receiveRetry(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityExceptionpublic void receiveSessionCreated(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityExceptionpublic void requestSent(DatagramPacket pkt)
public void setIntroState(Hash h, OutboundEstablishState2.IntroState state)
public void tokenRequestSent(DatagramPacket packet)
public String toString()
toString in class OutboundEstablishStatepublic boolean validateSessionCreated()
OutboundEstablishStatevalidateSessionCreated in class OutboundEstablishState