net.i2p.router.transport.udp
Class OutboundEstablishState

java.lang.Object
  extended by net.i2p.router.transport.udp.OutboundEstablishState

public class OutboundEstablishState
extends java.lang.Object

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


Field Summary
static int STATE_CONFIRMED_COMPLETELY
          we have received a data packet
static int STATE_CONFIRMED_PARTIALLY
          we have sent one or more confirmation packets
static int STATE_CREATED_RECEIVED
          we have received a signed creation packet
static int STATE_PENDING_INTRO
          we need to have someone introduce us to the peer, but haven't received a RelayResponse yet
static int STATE_REQUEST_SENT
          we have sent an initial request
static int STATE_UNKNOWN
          nothin sent yet
 
Constructor Summary
OutboundEstablishState(RouterContext ctx, java.net.InetAddress remoteHost, int remotePort, RouterIdentity remotePeer, SessionKey introKey, UDPAddress addr)
           
 
Method Summary
 void addMessage(OutNetMessage msg)
           
 boolean complete()
           
 void confirmedPacketsSent()
          note that we just sent the SessionConfirmed packet
 void dataReceived()
          we have received a real data packet, so we're done establishing
 void fail()
           
 SessionKey getCipherKey()
           
 long getEstablishBeginTime()
           
 SessionKey getIntroKey()
           
 long getIntroNonce()
           
 long getLifetime()
          how long have we been trying to establish this session?
 SessionKey getMACKey()
           
 OutNetMessage getNextQueuedMessage()
           
 long getNextSendTime()
           
 byte[] getReceivedIP()
           
 int getReceivedPort()
           
 long getReceivedRelayTag()
           
 long getReceivedSignedOnTime()
           
 UDPAddress getRemoteAddress()
           
(package private)  RemoteHostId getRemoteHostId()
          uniquely identifies an attempt
 RouterIdentity getRemoteIdentity()
           
 byte[] getSentIP()
           
 int getSentPort()
           
 Signature getSentSignature()
           
 long getSentSignedOnTime()
           
 byte[] getSentX()
           
 int getState()
           
 void introduced(java.net.InetAddress bob, byte[] bobIP, int bobPort)
           
 void introductionFailed()
           
 void introSent()
           
 void prepareSessionConfirmed()
          Lets sign everything so we can fragment properly
 void receiveSessionCreated(UDPPacketReader.SessionCreatedReader reader)
           
 void requestSent()
          note that we just sent the SessionRequest packet
 void setIntroNonce(long nonce)
           
 void setNextSendTime(long when)
           
 boolean validateSessionCreated()
          Blocking call (run in the establisher thread) to determine if the session was created properly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATE_UNKNOWN

public static final int STATE_UNKNOWN
nothin sent yet

See Also:
Constant Field Values

STATE_REQUEST_SENT

public static final int STATE_REQUEST_SENT
we have sent an initial request

See Also:
Constant Field Values

STATE_CREATED_RECEIVED

public static final int STATE_CREATED_RECEIVED
we have received a signed creation packet

See Also:
Constant Field Values

STATE_CONFIRMED_PARTIALLY

public static final int STATE_CONFIRMED_PARTIALLY
we have sent one or more confirmation packets

See Also:
Constant Field Values

STATE_CONFIRMED_COMPLETELY

public static final int STATE_CONFIRMED_COMPLETELY
we have received a data packet

See Also:
Constant Field Values

STATE_PENDING_INTRO

public static final int STATE_PENDING_INTRO
we need to have someone introduce us to the peer, but haven't received a RelayResponse yet

See Also:
Constant Field Values
Constructor Detail

OutboundEstablishState

public OutboundEstablishState(RouterContext ctx,
                              java.net.InetAddress remoteHost,
                              int remotePort,
                              RouterIdentity remotePeer,
                              SessionKey introKey,
                              UDPAddress addr)
Method Detail

getState

public int getState()

complete

public boolean complete()

getRemoteAddress

public UDPAddress getRemoteAddress()

setIntroNonce

public void setIntroNonce(long nonce)

getIntroNonce

public long getIntroNonce()

addMessage

public void addMessage(OutNetMessage msg)

getNextQueuedMessage

public OutNetMessage getNextQueuedMessage()

getRemoteIdentity

public RouterIdentity getRemoteIdentity()

getIntroKey

public SessionKey getIntroKey()

getSentX

public byte[] getSentX()

getSentIP

public byte[] getSentIP()

getSentPort

public int getSentPort()

receiveSessionCreated

public void receiveSessionCreated(UDPPacketReader.SessionCreatedReader reader)

validateSessionCreated

public boolean validateSessionCreated()
Blocking call (run in the establisher thread) to determine if the session was created properly. If it wasn't, all the SessionCreated remnants are dropped (perhaps they were spoofed, etc) so that we can receive another one


fail

public void fail()

getCipherKey

public SessionKey getCipherKey()

getMACKey

public SessionKey getMACKey()

getReceivedRelayTag

public long getReceivedRelayTag()

getSentSignedOnTime

public long getSentSignedOnTime()

getReceivedSignedOnTime

public long getReceivedSignedOnTime()

getReceivedIP

public byte[] getReceivedIP()

getReceivedPort

public int getReceivedPort()

prepareSessionConfirmed

public void prepareSessionConfirmed()
Lets sign everything so we can fragment properly


getSentSignature

public Signature getSentSignature()

confirmedPacketsSent

public void confirmedPacketsSent()
note that we just sent the SessionConfirmed packet


requestSent

public void requestSent()
note that we just sent the SessionRequest packet


introSent

public void introSent()

introductionFailed

public void introductionFailed()

introduced

public void introduced(java.net.InetAddress bob,
                       byte[] bobIP,
                       int bobPort)

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()
uniquely identifies an attempt


dataReceived

public void dataReceived()
we have received a real data packet, so we're done establishing