net.i2p.router.transport.udp

## Class InboundEstablishState

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

-      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. TODO do all these methods need to be synchronized?

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `STATE_CONFIRMED_COMPLETELY` we have completely received all of the confirmation packets
    `static int` | `STATE_CONFIRMED_PARTIALLY` we have received one or more confirmation packets
    `static int` | `STATE_CREATED_SENT` we have sent a signed creation packet
    `static int` | `STATE_FAILED` we are explicitly failing it
    `static int` | `STATE_REQUEST_RECEIVED` we have received an initial request
    `static int` | `STATE_UNKNOWN` nothin known yet

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InboundEstablishState(RouterContext ctx, byte[] remoteIP, int remotePort, int localPort)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `complete()`
    `boolean` | `confirmedFullyReceived()` have we fully received the SessionConfirmed messages from Alice?
    `void` | `createdPacketSent()` note that we just sent a SessionCreated packet
    `void` | `fail()`
    `void` | `generateSessionKey()`
    `byte[]` | `getBobIP()`
    `SessionKey` | `getCipherKey()`
    `RouterIdentity` | `getConfirmedIdentity()` Who is Alice (null if forged/unknown)
    `long` | `getEstablishBeginTime()`
    `long` | `getLifetime()` how long have we been trying to establish this session?
    `SessionKey` | `getMACKey()`
    `long` | `getNextSendTime()`
    `byte[]` | `getReceivedOurIP()`
    `byte[]` | `getReceivedX()`
    `(package private) RemoteHostId` | `getRemoteHostId()` RemoteHostId, uniquely identifies an attempt
    `byte[]` | `getSentIP()` what IP do they appear to be on?
    `int` | `getSentPort()` what port number do they appear to be coming from?
    `long` | `getSentRelayTag()`
    `Signature` | `getSentSignature()`
    `long` | `getSentSignedOnTime()`
    `byte[]` | `getSentY()`
    `int` | `getState()`
    `void` | `prepareSessionCreated()`
    `void` | `receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf)`
    `void` | `receiveSessionRequest(UDPPacketReader.SessionRequestReader req)`
    `boolean` | `sessionRequestReceived()`
    `void` | `setNextSendTime(long when)`
    `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

    - #### STATE_UNKNOWN

          public static final int STATE_UNKNOWN

      nothin known yet
      See Also:
        Constant Field Values

    - #### STATE_REQUEST_RECEIVED

          public static final int STATE_REQUEST_RECEIVED

      we have received an initial request
      See Also:
        Constant Field Values

    - #### STATE_CREATED_SENT

          public static final int STATE_CREATED_SENT

      we have sent a signed creation packet
      See Also:
        Constant Field Values

    - #### STATE_CONFIRMED_PARTIALLY

          public static final int STATE_CONFIRMED_PARTIALLY

      we have received one or more confirmation packets
      See Also:
        Constant Field Values

    - #### STATE_CONFIRMED_COMPLETELY

          public static final int STATE_CONFIRMED_COMPLETELY

      we have completely received all of the confirmation packets
      See Also:
        Constant Field Values

    - #### STATE_FAILED

          public static final int STATE_FAILED

      we are explicitly failing it
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InboundEstablishState

          public InboundEstablishState(RouterContext ctx,
                               byte[] remoteIP,
                               int remotePort,
                               int localPort)

  - ### Method Detail

    - #### getState

          public int getState()

    - #### complete

          public boolean complete()

    - #### receiveSessionRequest

          public void receiveSessionRequest(UDPPacketReader.SessionRequestReader req)

    - #### sessionRequestReceived

          public boolean sessionRequestReceived()

    - #### getReceivedX

          public byte[] getReceivedX()

    - #### getReceivedOurIP

          public byte[] getReceivedOurIP()

    - #### generateSessionKey

          public void generateSessionKey()
                                  throws DHSessionKeyBuilder.InvalidPublicParameterException

      Throws:
        `DHSessionKeyBuilder.InvalidPublicParameterException`

    - #### getCipherKey

          public SessionKey getCipherKey()

    - #### getMACKey

          public SessionKey getMACKey()

    - #### 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?

    - #### getBobIP

          public byte[] getBobIP()

    - #### getSentY

          public byte[] getSentY()

    - #### fail

          public void fail()

    - #### getSentRelayTag

          public long getSentRelayTag()

    - #### setSentRelayTag

          public void setSentRelayTag(long tag)

    - #### getSentSignedOnTime

          public long getSentSignedOnTime()

    - #### prepareSessionCreated

          public void prepareSessionCreated()

    - #### getSentSignature

          public Signature getSentSignature()

    - #### createdPacketSent

          public void createdPacketSent()

      note that we just sent a SessionCreated packet

    - #### getLifetime

          public long getLifetime()

      how long have we been trying to establish this session?

    - #### getEstablishBeginTime

          public long getEstablishBeginTime()

    - #### getNextSendTime

          public long getNextSendTime()

    - #### setNextSendTime

          public void setNextSendTime(long when)

    - #### getRemoteHostId

          RemoteHostId getRemoteHostId()

      RemoteHostId, uniquely identifies an attempt

    - #### receiveSessionConfirmed

          public void receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf)

    - #### confirmedFullyReceived

          public boolean confirmedFullyReceived()

      have we fully received the SessionConfirmed messages from Alice?

    - #### getConfirmedIdentity

          public RouterIdentity getConfirmedIdentity()

      Who is Alice (null if forged/unknown)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`