net.i2p.router.transport.udp

## Class InboundEstablishState

- java.lang.Object
- - net.i2p.router.transport.udp.InboundEstablishState

- Direct Known Subclasses:
    InboundEstablishState2

      class InboundEstablishState
      extends Object

  Data for a new connection being established, where the remote peer has initiated the connection with us. In other words, they are Alice and we are Bob.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `InboundEstablishState.InboundState` States for inbound SSU session establishment.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected byte[]` | `_aliceIP`
    `protected int` | `_alicePort`
    `protected byte[]` | `_bobIP`
    `protected int` | `_bobPort`
    `protected RouterContext` | `_context`
    `protected int` | `_createdSentCount`
    `protected InboundEstablishState.InboundState` | `_currentState`
    `protected long` | `_establishBegin`
    `protected boolean` | `_introductionRequested`
    `protected long` | `_lastSend`
    `protected Log` | `_log`
    `protected long` | `_nextSend`
    `protected RouterIdentity` | `_receivedConfirmedIdentity`
    `protected RouterIdentity` | `_receivedUnconfirmedIdentity`
    `protected RemoteHostId` | `_remoteHostId`
    `protected int` | `_rtt`
    `protected long` | `_sentRelayTag`
    `protected static long` | `MAX_DELAY` Max delay including backoff.
    `protected static long` | `RETRANSMIT_DELAY` Basic delay before backoff Transmissions at 0, 1, 3, 7 sec.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `InboundEstablishState(RouterContext ctx, InetSocketAddress addr)` For SSU2

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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
    `protected boolean` | `confirmedFullyReceived()` Have we fully received the SessionConfirmed messages from Alice? Caller must synch on this.
    `void` | `createdPacketSent()` Note that we just sent a SessionCreated packet
    `void` | `fail()`
    `RouterIdentity` | `getConfirmedIdentity()` Who is Alice (null if forged/unknown) Note that this isn't really confirmed - see below.
    `long` | `getEstablishBeginTime()`
    `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?
    `OutNetMessage` | `getNextQueuedMessage()` Pull from the message queue
    `long` | `getNextSendTime()`
    `byte[]` | `getReceivedOurIP()`
    `byte[]` | `getReceivedX()`
    `(package private) RemoteHostId` | `getRemoteHostId()` RemoteHostId, uniquely identifies an attempt
    `(package private) int` | `getRTT()`
    `byte[]` | `getSentIP()` What IP do they appear to be on?
    `int` | `getSentPort()` What port number do they appear to be coming from?
    `long` | `getSentRelayTag()`
    `long` | `getSentSignedOnTime()`
    `InboundEstablishState.InboundState` | `getState()`
    `int` | `getVersion()`
    `boolean` | `isComplete()`
    `boolean` | `isIntroductionRequested()` True (default) if no extended options in session request, or value of flag bit in the extended options.
    `protected void` | `packetReceived()` Call from synchronized method only
    `boolean` | `sessionRequestReceived()`
    `void` | `setSentRelayTag(long tag)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _aliceIP

          protected final byte[] _aliceIP

    - #### _alicePort

          protected final int _alicePort

    - #### _bobIP

          protected byte[] _bobIP

    - #### _bobPort

          protected final int _bobPort

    - #### _context

          protected final RouterContext _context

    - #### _createdSentCount

          protected int _createdSentCount

    - #### _currentState

          protected InboundEstablishState.InboundState _currentState

    - #### _establishBegin

          protected final long _establishBegin

    - #### _introductionRequested

          protected boolean _introductionRequested

    - #### _lastSend

          protected long _lastSend

    - #### _log

          protected final Log _log

    - #### _nextSend

          protected long _nextSend

    - #### _receivedConfirmedIdentity

          protected RouterIdentity _receivedConfirmedIdentity

    - #### _receivedUnconfirmedIdentity

          protected RouterIdentity _receivedUnconfirmedIdentity

    - #### _remoteHostId

          protected final RemoteHostId _remoteHostId

    - #### _rtt

          protected int _rtt

    - #### _sentRelayTag

          protected long _sentRelayTag

    - #### MAX_DELAY

          protected static final long MAX_DELAY

      Max delay including backoff. This should be a little shorter than for outbound.

    - #### RETRANSMIT_DELAY

          protected static final long RETRANSMIT_DELAY

      Basic delay before backoff Transmissions at 0, 1, 3, 7 sec. This should be a little shorter than for outbound.

  - ### Constructor Detail

    - #### InboundEstablishState

          protected InboundEstablishState(RouterContext ctx,
                                          InetSocketAddress addr)

      For SSU2

  - ### Method Detail

    - #### addMessage

          public void addMessage(OutNetMessage msg)

      Queue a message to be sent after the session is established. This will only happen if we decide to send something during establishment

    - #### complete

          public void complete()

      Notify successful completion

    - #### confirmedFullyReceived

          protected boolean confirmedFullyReceived()

      Have we fully received the SessionConfirmed messages from Alice? Caller must synch on this.

    - #### createdPacketSent

          public void createdPacketSent()

      Note that we just sent a SessionCreated packet

    - #### fail

          public void fail()

    - #### getConfirmedIdentity

          public RouterIdentity getConfirmedIdentity()

      Who is Alice (null if forged/unknown) Note that this isn't really confirmed - see below.

    - #### getEstablishBeginTime

          public long getEstablishBeginTime()

    - #### getLifetime

          public long getLifetime()

      How long have we been trying to establish this session?

    - #### getLifetime

          public long getLifetime(long now)

      How long have we been trying to establish this session?

    - #### getNextQueuedMessage

          public OutNetMessage getNextQueuedMessage()

      Pull from the message queue
      Returns:
        null if none

    - #### getNextSendTime

          public long getNextSendTime()

      Returns:
        rcv time after receiving a packet (including after constructor), send time + delay after sending a packet

    - #### getReceivedOurIP

          public byte[] getReceivedOurIP()

    - #### getReceivedX

          public byte[] getReceivedX()

    - #### getRemoteHostId

          RemoteHostId getRemoteHostId()

      RemoteHostId, uniquely identifies an attempt

    - #### getRTT

          int getRTT()

    - #### getSentIP

          public byte[] getSentIP()

      What IP do they appear to be on?

    - #### getSentPort

          public int getSentPort()

      What port number do they appear to be coming from?

    - #### getSentRelayTag

          public long getSentRelayTag()

    - #### getSentSignedOnTime

          public long getSentSignedOnTime()

    - #### getState

          public InboundEstablishState.InboundState getState()

    - #### getVersion

          public int getVersion()

    - #### isComplete

          public boolean isComplete()

      Returns:
        if previously complete

    - #### isIntroductionRequested

          public boolean isIntroductionRequested()

      True (default) if no extended options in session request, or value of flag bit in the extended options.

    - #### packetReceived

          protected void packetReceived()

      Call from synchronized method only

    - #### sessionRequestReceived

          public boolean sessionRequestReceived()

    - #### setSentRelayTag

          public void setSentRelayTag(long tag)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`