Package net.i2p.router.transport.ntcp
Class EstablishBase
java.lang.Object
net.i2p.router.transport.ntcp.EstablishBase
- All Implemented Interfaces:
EstablishState
- Direct Known Subclasses:
InboundEstablishState
Inbound NTCP 2 only.
OutboundNTCP2State does not extend this.
- Since:
- 0.9.35 pulled out of EstablishState
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NTCPConnectionprotected final RouterContextprotected final Logprotected longOUR clock minus HIS clock, in seconds Inbound: tsB - tsA - rtt/2 Outbound: tsA - tsB - rtt/2protected byte[]previously received encrypted block (or the IV)protected intbytes received so farprotected EstablishBase.Stateprotected final Objectprotected final NTCPTransportprotected final byte[]protected final byte[]protected static final intstatic final net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishStateprotected static final intprotected static final intprotected static final Set<EstablishBase.State> static final net.i2p.router.transport.ntcp.EstablishBase.VerifiedEstablishStateprotected static final int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEstablishBase(RouterContext ctx, NTCPTransport transport, NTCPConnection con) -
Method Summary
Modifier and TypeMethodDescriptionprotected static final StringMark a string for extraction by xgettext and translation.protected voidchangeState(EstablishBase.State state) voidRelease resources on timeout.protected voidCaller must synch.protected voidCaller must synch.protected voidCaller must synch.abstract intGet the NTCP versionbooleanIf synchronized on this, fails with deadlocks from all over via CSFI.isEstablished().booleandid the handshake fail for some reason?protected Stringprefix()voidDoes nothing.voidreceive(ByteBuffer src) Parse the contents of the buffer as part of the handshake.protected voidreleaseBufs(boolean isVerified) Only call once.toString()
-
Field Details
-
VERIFIED
public static final net.i2p.router.transport.ntcp.EstablishBase.VerifiedEstablishState VERIFIED -
FAILED
public static final net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishState FAILED -
_context
-
_log
-
_X
protected final byte[] _X -
_Y
protected final byte[] _Y -
_peerSkew
protected transient long _peerSkewOUR clock minus HIS clock, in seconds Inbound: tsB - tsA - rtt/2 Outbound: tsA - tsB - rtt/2 -
_prevEncrypted
protected byte[] _prevEncryptedpreviously received encrypted block (or the IV) -
_received
protected int _receivedbytes received so far -
_transport
-
_con
-
MIN_RI_SIZE
protected static final int MIN_RI_SIZE- See Also:
-
MAX_RI_SIZE
protected static final int MAX_RI_SIZE- See Also:
-
AES_SIZE
protected static final int AES_SIZE- See Also:
-
XY_SIZE
protected static final int XY_SIZE- See Also:
-
_stateLock
-
_state
-
STATES_DONE
-
-
Constructor Details
-
EstablishBase
-
-
Method Details
-
changeState
- Since:
- 0.9.16
-
receive
Parse the contents of the buffer as part of the handshake. All data must be copied out of the buffer as Reader.processRead() will return it to the pool. If there are additional data in the buffer after the handshake is complete, the EstablishState is responsible for passing it to NTCPConnection.- Specified by:
receivein interfaceEstablishState
-
prepareOutbound
public void prepareOutbound()Does nothing. Outbound (Alice) must override. We are establishing an outbound connection, so prepare ourselves by queueing up the write of the first part of the handshake- Specified by:
prepareOutboundin interfaceEstablishState
-
isCorrupt
public boolean isCorrupt()did the handshake fail for some reason?- Specified by:
isCorruptin interfaceEstablishState
-
isComplete
public boolean isComplete()If synchronized on this, fails with deadlocks from all over via CSFI.isEstablished(). Also CSFI.getFramedAveragePeerClockSkew().- Specified by:
isCompletein interfaceEstablishState- Returns:
- is the handshake complete and valid?
-
getVersion
public abstract int getVersion()Get the NTCP version- Specified by:
getVersionin interfaceEstablishState- Returns:
- 1, 2, or 0 if unknown
- Since:
- 0.9.35
-
close
Release resources on timeout.- Specified by:
closein interfaceEstablishState- Parameters:
e- may be null- Since:
- 0.9.16
-
fail
Caller must synch. -
fail
Caller must synch. -
fail
Caller must synch. -
releaseBufs
protected void releaseBufs(boolean isVerified) Only call once. Caller must synch.- Since:
- 0.9.16
-
prefix
-
toString
-
_x
Mark a string for extraction by xgettext and translation. Use this only in static initializers. It does not translate!- Returns:
- s
-