Package net.i2p.router.transport.udp
Class OutboundEstablishState
- java.lang.Object
- 
- net.i2p.router.transport.udp.OutboundEstablishState
 
- 
 class OutboundEstablishState extends 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.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classOutboundEstablishState.OutboundState
 - 
Constructor SummaryConstructors Constructor Description OutboundEstablishState(RouterContext ctx, RemoteHostId claimedAddress, RemoteHostId remoteHostId, RouterIdentity remotePeer, boolean allowExtendedOptions, boolean needIntroduction, SessionKey introKey, UDPAddress addr, DHSessionKeyBuilder.Factory dh)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(OutNetMessage msg)Queue a message to be sent after the session is established.booleancomplete()voidconfirmedPacketsSent()note that we just sent the SessionConfirmed packetvoiddataReceived()we have received a real data packet, so we're done establishingvoidfail()The SessionCreated validation failedSessionKeygetCipherKey()(package private) RemoteHostIdgetClaimedAddress()This will never be a hash-based address.longgetConfirmedSentTime()longgetEstablishBeginTime()SessionKeygetIntroKey()Bob's introduction key, as published in the netdblonggetIntroNonce()longgetIntroSentTime()longgetLifetime()how long have we been trying to establish this session?SessionKeygetMACKey()OutNetMessagegetNextQueuedMessage()longgetNextSendTime()byte[]getReceivedIP()intgetReceivedPort()longgetReceivedRelayTag()longgetReceivedSignedOnTime()UDPAddressgetRemoteAddress()(package private) RemoteHostIdgetRemoteHostId()This should be what the state is currently indexed by in the _outboundStates table.RouterIdentitygetRemoteIdentity()longgetRequestSentTime()(package private) intgetRTT()byte[]getSentIP()The remote side (Bob) - note that in some places he's called Charlie.intgetSentPort()The remote side (Bob) - note that in some places he's called Charlie.SignaturegetSentSignature()longgetSentSignedOnTime()byte[]getSentX()OutboundEstablishState.OutboundStategetState()voidintroduced(byte[] bobIP, int bobPort)This changes the remoteHostId from a hash-based one or possibly incorrect IP/port to what the introducer told us.voidintroductionFailed()voidintroSent()note that we just sent the RelayRequest packetbooleanisExtendedOptionsAllowed()Are we allowed to send extended options to this peer?booleanisFirstMessageOurDSM()Is the first message queued our own DatabaseStoreMessage?booleanneedIntroduction()Should we ask this peer to be an introducer for us? Ignored unless allowExtendedOptions is truevoidprepareSessionConfirmed()Let's sign everything so we can fragment properly.(package private) booleanreceiveHolePunch()Accelerate response to RelayResponse if we haven't sent it yet.voidreceiveSessionCreated(UDPPacketReader.SessionCreatedReader reader)voidrequestSent()note that we just sent the SessionRequest packetvoidsetIntroNonce(long nonce)StringtoString()booleanvalidateSessionCreated()Blocking call (run in the establisher thread) to determine if the session was created properly.
 
- 
- 
- 
Constructor Detail- 
OutboundEstablishStatepublic OutboundEstablishState(RouterContext ctx, RemoteHostId claimedAddress, RemoteHostId remoteHostId, RouterIdentity remotePeer, boolean allowExtendedOptions, boolean needIntroduction, SessionKey introKey, UDPAddress addr, DHSessionKeyBuilder.Factory dh) - Parameters:
- claimedAddress- an IP/port based RemoteHostId, or null if unknown
- remoteHostId- non-null, == claimedAddress if direct, or a hash-based one if indirect
- remotePeer- must have supported sig type
- allowExtendedOptions- are we allowed to send extended options to Bob?
- needIntroduction- should we ask Bob to be an introducer for us? ignored unless allowExtendedOptions is true
- introKey- Bob's introduction key, as published in the netdb
- addr- non-null
 
 
- 
 - 
Method Detail- 
getStatepublic OutboundEstablishState.OutboundState getState() 
 - 
completepublic boolean complete() - Returns:
- if previously complete
 
 - 
getRemoteAddresspublic UDPAddress getRemoteAddress() - Returns:
- non-null
 
 - 
setIntroNoncepublic void setIntroNonce(long nonce) 
 - 
getIntroNoncepublic long getIntroNonce() - Returns:
- -1 if unset
 
 - 
isExtendedOptionsAllowedpublic boolean isExtendedOptionsAllowed() Are we allowed to send extended options to this peer?- Since:
- 0.9.24
 
 - 
needIntroductionpublic boolean needIntroduction() Should we ask this peer to be an introducer for us? Ignored unless allowExtendedOptions is true- Since:
- 0.9.24
 
 - 
getRTTint getRTT() 
 - 
addMessagepublic void addMessage(OutNetMessage msg) Queue a message to be sent after the session is established.
 - 
isFirstMessageOurDSMpublic boolean isFirstMessageOurDSM() Is the first message queued our own DatabaseStoreMessage?- Since:
- 0.9.12
 
 - 
getNextQueuedMessagepublic OutNetMessage getNextQueuedMessage() - Returns:
- null if none
 
 - 
getRemoteIdentitypublic RouterIdentity getRemoteIdentity() 
 - 
getIntroKeypublic SessionKey getIntroKey() Bob's introduction key, as published in the netdb
 - 
getSentXpublic byte[] getSentX() 
 - 
getSentIPpublic byte[] getSentIP() The remote side (Bob) - note that in some places he's called Charlie. Warning - may change after introduction. May be null before introduction.
 - 
getSentPortpublic int getSentPort() The remote side (Bob) - note that in some places he's called Charlie. Warning - may change after introduction. May be -1 before introduction.
 - 
receiveSessionCreatedpublic void receiveSessionCreated(UDPPacketReader.SessionCreatedReader reader) 
 - 
validateSessionCreatedpublic 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 Generates session key and mac key.- Returns:
- true if valid
 
 - 
failpublic void fail() The SessionCreated validation failed
 - 
getCipherKeypublic SessionKey getCipherKey() 
 - 
getMACKeypublic SessionKey getMACKey() 
 - 
getReceivedRelayTagpublic long getReceivedRelayTag() 
 - 
getSentSignedOnTimepublic long getSentSignedOnTime() 
 - 
getReceivedSignedOnTimepublic long getReceivedSignedOnTime() 
 - 
getReceivedIPpublic byte[] getReceivedIP() 
 - 
getReceivedPortpublic int getReceivedPort() 
 - 
prepareSessionConfirmedpublic void prepareSessionConfirmed() Let's sign everything so we can fragment properly. Note that while a SessionConfirmed could in theory be fragmented, in practice a RouterIdentity is 387 bytes and a single fragment is 512 bytes max, so it will never be fragmented.
 - 
getSentSignaturepublic Signature getSentSignature() 
 - 
confirmedPacketsSentpublic void confirmedPacketsSent() note that we just sent the SessionConfirmed packet
 - 
getConfirmedSentTimepublic long getConfirmedSentTime() - Returns:
- when we sent the first SessionConfirmed packet, or 0
- Since:
- 0.9.2
 
 - 
requestSentpublic void requestSent() note that we just sent the SessionRequest packet
 - 
getRequestSentTimepublic long getRequestSentTime() - Returns:
- when we sent the first SessionRequest packet, or 0
- Since:
- 0.9.2
 
 - 
introSentpublic void introSent() note that we just sent the RelayRequest packet
 - 
getIntroSentTimepublic long getIntroSentTime() - Returns:
- when we sent the first RelayRequest packet, or 0
- Since:
- 0.9.2
 
 - 
introductionFailedpublic void introductionFailed() 
 - 
introducedpublic void introduced(byte[] bobIP, int bobPort)This changes the remoteHostId from a hash-based one or possibly incorrect IP/port to what the introducer told us. All params are for the remote end (NOT the introducer) and must have been validated already.
 - 
receiveHolePunchboolean receiveHolePunch() Accelerate response to RelayResponse if we haven't sent it yet.- Returns:
- true if we should send the SessionRequest now
- Since:
- 0.9.15
 
 - 
getLifetimepublic long getLifetime() how long have we been trying to establish this session?
 - 
getEstablishBeginTimepublic long getEstablishBeginTime() 
 - 
getNextSendTimepublic long getNextSendTime() - Returns:
- 0 at initialization (to force sending session request), rcv time after receiving a packet, send time + delay after sending a packet (including session request)
 
 - 
getRemoteHostIdRemoteHostId getRemoteHostId() This should be what the state is currently indexed by in the _outboundStates table. Beware - During introduction, this is a router hash. After introduced() is called, this is set to the IP/port the introducer told us.- Returns:
- non-null
 
 - 
getClaimedAddressRemoteHostId getClaimedAddress() This will never be a hash-based address. This is the 'claimed' (unverified) address from the netdb, or null. It is not changed after introduction. Use getRemoteHostId() for the verified address.- Returns:
- may be null
 
 - 
dataReceivedpublic void dataReceived() we have received a real data packet, so we're done establishing
 
- 
 
-