abstract class EstablishBase extends Object implements EstablishState
| Modifier and Type | Class and Description |
|---|---|
protected static class |
EstablishBase.State
States for NTCP connection establishment process.
|
| Modifier and Type | Field and Description |
|---|---|
protected NTCPConnection |
_con |
protected RouterContext |
_context |
protected Log |
_log |
protected long |
_peerSkew
OUR clock minus HIS clock, in seconds
Inbound: tsB - tsA - rtt/2
Outbound: tsA - tsB - rtt/2
|
protected byte[] |
_prevEncrypted
previously received encrypted block (or the IV)
|
protected int |
_received
bytes received so far
|
protected EstablishBase.State |
_state |
protected Object |
_stateLock |
protected NTCPTransport |
_transport |
protected byte[] |
_X |
protected byte[] |
_Y |
protected static int |
AES_SIZE |
static net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishState |
FAILED |
protected static int |
MAX_RI_SIZE |
protected static int |
MIN_RI_SIZE |
protected static Set<EstablishBase.State> |
STATES_DONE |
static net.i2p.router.transport.ntcp.EstablishBase.VerifiedEstablishState |
VERIFIED |
protected static int |
XY_SIZE |
| Modifier | Constructor and Description |
|---|---|
protected |
EstablishBase(RouterContext ctx,
NTCPTransport transport,
NTCPConnection con) |
| Modifier and Type | Method and Description |
|---|---|
protected static String |
_x(String s)
Mark a string for extraction by xgettext and translation.
|
protected void |
changeState(EstablishBase.State state) |
void |
close(String reason,
Exception e)
Release resources on timeout.
|
protected void |
fail(String reason)
Caller must synch.
|
protected void |
fail(String reason,
Exception e)
Caller must synch.
|
protected void |
fail(String reason,
Exception e,
boolean bySkew)
Caller must synch.
|
abstract int |
getVersion()
Get the NTCP version
|
boolean |
isComplete()
If synchronized on this, fails with
deadlocks from all over via CSFI.isEstablished().
|
boolean |
isCorrupt()
did the handshake fail for some reason?
|
protected String |
prefix() |
void |
prepareOutbound()
Does nothing.
|
void |
receive(ByteBuffer src)
Parse the contents of the buffer as part of the handshake.
|
protected void |
releaseBufs(boolean isVerified)
Only call once.
|
String |
toString() |
protected final NTCPConnection _con
protected final RouterContext _context
protected final Log _log
protected transient long _peerSkew
protected byte[] _prevEncrypted
protected int _received
protected volatile EstablishBase.State _state
protected final Object _stateLock
protected final NTCPTransport _transport
protected final byte[] _X
protected final byte[] _Y
protected static final int AES_SIZE
public static final net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishState FAILED
protected static final int MAX_RI_SIZE
protected static final int MIN_RI_SIZE
protected static final Set<EstablishBase.State> STATES_DONE
public static final net.i2p.router.transport.ntcp.EstablishBase.VerifiedEstablishState VERIFIED
protected static final int XY_SIZE
protected EstablishBase(RouterContext ctx, NTCPTransport transport, NTCPConnection con)
protected static final String _x(String s)
protected void changeState(EstablishBase.State state)
public void close(String reason, Exception e)
close in interface EstablishStatee - may be nullprotected void fail(String reason)
public abstract int getVersion()
getVersion in interface EstablishStatepublic boolean isComplete()
isComplete in interface EstablishStatepublic boolean isCorrupt()
isCorrupt in interface EstablishStateprotected String prefix()
public void prepareOutbound()
prepareOutbound in interface EstablishStatepublic void receive(ByteBuffer src)
receive in interface EstablishStateprotected void releaseBufs(boolean isVerified)