class InboundEstablishState extends Object
| Modifier and Type | Class and Description |
|---|---|
static class | InboundEstablishState.InboundStateStates for inbound SSU session establishment. |
| Modifier and Type | Field and Description |
|---|---|
protected byte[] | _aliceIPAlice's IP address from the SessionCreated message |
protected int | _alicePortAlice's port number |
protected byte[] | _bobIPOur IP address as seen by Alice |
protected int | _bobPortOur port number as seen by Alice |
protected RouterContext | _contextRouter context |
protected int | _createdSentCountCount of SessionCreated packets sent (for exponential backoff) |
protected InboundEstablishState.InboundState | _currentStateCurrent state in the inbound establishment protocol |
protected long | _establishBeginTimestamp when establishment began |
protected boolean | _introductionRequestedWhether Alice requested introduction (default true for SSU 1, false for SSU 2) |
protected long | _lastSendLast packet send time |
protected Log | _logLogger |
protected long | _nextSendNext scheduled send time |
protected RouterIdentity | _receivedConfirmedIdentityIdentity after successful signature verification |
protected RouterIdentity | _receivedUnconfirmedIdentityIdentity before signature verification |
protected RemoteHostId | _remoteHostIdRemote host identifier for uniqueness |
protected int | _rttEstimated round-trip time |
protected long | _sentRelayTagRelay tag we sent to Alice |
protected static long | RETRANSMIT_DELAYBasic delay before backoff
Transmissions at 0, 1, 3, 7 sec. |
| Modifier | Constructor and Description |
|---|---|
protected | InboundEstablishState(RouterContext ctx,
InetSocketAddress addr)For SSU2 |
| Modifier and Type | Method and Description |
|---|---|
void | addMessage(OutNetMessage msg)Queue a message to be sent after the session is established. |
void | complete()Notify successful completion of the inbound session establishment. |
protected boolean | confirmedFullyReceived()Have we fully received the SessionConfirmed messages from Alice?
Caller must synchronize on this. |
void | createdPacketSent()Record that a SessionCreated packet was just sent, update backoff state. |
void | fail()Mark this establishment attempt as failed. |
RouterIdentity | getConfirmedIdentity()The confirmed identity of Alice (null if forged/unknown). |
long | getEstablishBeginTime()The wall clock time when this establishment attempt began. |
long | getLifetime()How long have we been trying to establish this session? |
long | getLifetime(long now)How long have we been trying to establish this session, using the given time. |
protected static long | getMaxDelay()Max delay including backoff. |
OutNetMessage | getNextQueuedMessage()Pull from the message queue |
long | getNextSendTime()The next time at which we should send a packet for this establishment. |
byte[] | getReceivedOurIP()Our IP address as reported by Alice in the SessionRequest. |
byte[] | getReceivedX()The received X value from Alice's SessionRequest message. |
(package private) RemoteHostId | getRemoteHostId()The RemoteHostId that uniquely identifies this establishment attempt. |
(package private) int | getRTT()The estimated round-trip time for this establishment. |
byte[] | getSentIP()Alice's apparent IP address. |
int | getSentPort()Alice's apparent port number. |
long | getSentRelayTag()The relay tag we sent to Alice in the SessionCreated message. |
long | getSentSignedOnTime()The signed-on time we sent to Alice. |
InboundEstablishState.InboundState | getState()Current state of the inbound session establishment. |
int | getVersion()Return the SSU protocol version for this state (always 1 for SSU1). |
boolean | isComplete()Check if the inbound establish state is complete. |
boolean | isIntroductionRequested()Whether Alice requested an introduction. |
protected void | packetReceived()Update the next send time to now, as we just received a packet. |
boolean | sessionRequestReceived()Whether the SessionRequest message has been received from Alice. |
void | setSentRelayTag(long tag)Set the relay tag to include in the SessionCreated message. |
String | toString()Return a human-readable description of this establish state. |
protected final byte[] _aliceIP
protected final int _alicePort
protected byte[] _bobIP
protected final int _bobPort
protected final RouterContext _context
protected int _createdSentCount
protected InboundEstablishState.InboundState _currentState
protected final long _establishBegin
protected boolean _introductionRequested
protected long _lastSend
protected final Log _log
protected long _nextSend
protected RouterIdentity _receivedConfirmedIdentity
protected RouterIdentity _receivedUnconfirmedIdentity
protected final RemoteHostId _remoteHostId
protected int _rtt
protected long _sentRelayTag
protected static final long RETRANSMIT_DELAY
protected InboundEstablishState(RouterContext ctx, InetSocketAddress addr)
public void addMessage(OutNetMessage msg)
public void complete()
protected boolean confirmedFullyReceived()
public void createdPacketSent()
public void fail()
public RouterIdentity getConfirmedIdentity()
public long getEstablishBeginTime()
public long getLifetime()
public long getLifetime(long now)
now - the reference timeprotected static long getMaxDelay()
public OutNetMessage getNextQueuedMessage()
public long getNextSendTime()
public byte[] getReceivedOurIP()
public byte[] getReceivedX()
RemoteHostId getRemoteHostId()
int getRTT()
public byte[] getSentIP()
public int getSentPort()
public long getSentRelayTag()
public long getSentSignedOnTime()
public InboundEstablishState.InboundState getState()
public int getVersion()
public boolean isComplete()
public boolean isIntroductionRequested()
protected void packetReceived()
public boolean sessionRequestReceived()
public void setSentRelayTag(long tag)
tag - the relay tag