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
|
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, setIntroNonce
public 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-nullIllegalArgumentException
public void introduced(byte[] ip, int port, long token)
public void gotDateTime(long time)
gotDateTime
in interface SSU2Payload.PayloadCallback
public void gotOptions(byte[] options, boolean isHandshake)
gotOptions
in interface SSU2Payload.PayloadCallback
isHandshake
- true only for message 3 part 2public void gotRI(RouterInfo ri, boolean isHandshake, boolean flood) throws DataFormatException
gotRI
in interface SSU2Payload.PayloadCallback
ri
- will already be validatedisHandshake
- true only for message 3 part 2DataFormatException
public void gotRIFragment(byte[] data, boolean isHandshake, boolean flood, boolean isGzipped, int frag, int totalFrags)
gotRIFragment
in interface SSU2Payload.PayloadCallback
data
- is first gzipped and then fragmentedisHandshake
- true only for message 3 part 2public void gotAddress(byte[] ip, int port)
gotAddress
in interface SSU2Payload.PayloadCallback
public void gotRelayTagRequest()
gotRelayTagRequest
in interface SSU2Payload.PayloadCallback
public void gotRelayTag(long tag)
gotRelayTag
in interface SSU2Payload.PayloadCallback
public void gotRelayRequest(byte[] data)
gotRelayRequest
in interface SSU2Payload.PayloadCallback
data
- excludes flag, includes signaturepublic void gotRelayResponse(int status, byte[] data)
gotRelayResponse
in interface SSU2Payload.PayloadCallback
status
- 0 = accept, 1-255 = rejectdata
- excludes flag, includes signaturepublic void gotRelayIntro(Hash aliceHash, byte[] data)
gotRelayIntro
in interface SSU2Payload.PayloadCallback
data
- excludes flag, includes signaturepublic void gotPeerTest(int msg, int status, Hash h, byte[] data)
gotPeerTest
in interface SSU2Payload.PayloadCallback
msg
- 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 gotToken(long token, long expires)
gotToken
in interface SSU2Payload.PayloadCallback
public void gotI2NP(I2NPMessage msg)
gotI2NP
in interface SSU2Payload.PayloadCallback
public void gotFragment(byte[] data, int off, int len, long messageId, int frag, boolean isLast) throws DataFormatException
SSU2Payload.PayloadCallback
gotFragment
in interface SSU2Payload.PayloadCallback
off
- offset in datalen
- length of data to copyDataFormatException
public void gotACK(long ackThru, int acks, byte[] ranges)
gotACK
in interface SSU2Payload.PayloadCallback
ranges
- null if nonepublic void gotTermination(int reason, long count)
gotTermination
in interface SSU2Payload.PayloadCallback
count
- in theory could wrap around to negative, but very unlikelypublic void gotPathChallenge(RemoteHostId from, byte[] data)
gotPathChallenge
in interface SSU2Payload.PayloadCallback
from
- null if unknownpublic void gotPathResponse(RemoteHostId from, byte[] data)
gotPathResponse
in interface SSU2Payload.PayloadCallback
from
- null if unknownpublic void fail()
fail
in class OutboundEstablishState
public boolean validateSessionCreated()
OutboundEstablishState
validateSessionCreated
in class OutboundEstablishState
boolean receiveHolePunch()
receiveHolePunch
in class OutboundEstablishState
public int getVersion()
getVersion
in class OutboundEstablishState
public long getSendConnID()
public long getRcvConnID()
public long getToken()
public EstablishmentManager.Token getNextToken()
public HandshakeState getHandshakeState()
public byte[] getSendHeaderEncryptKey1()
public byte[] getRcvHeaderEncryptKey1()
public byte[] getSendHeaderEncryptKey2()
public byte[] getRcvHeaderEncryptKey2()
public byte[] getRcvRetryHeaderEncryptKey2()
public InetSocketAddress getSentAddress()
public int getMTU()
public void receiveRetry(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityException
public void receiveSessionCreated(UDPPacket packet) throws GeneralSecurityException
GeneralSecurityException
public void tokenRequestSent(DatagramPacket packet)
public void requestSent(DatagramPacket pkt)
public PeerState2 confirmedPacketsSent(UDPPacket[] packets)
public UDPPacket getRetransmitSessionRequestPacket()
public PeerState2 getPeerState()
public OutboundEstablishState2.IntroState getIntroState(Hash h)
public void setIntroState(Hash h, OutboundEstablishState2.IntroState state)
public void introSent(Hash h)
public String toString()
toString
in class OutboundEstablishState