abstract class EstablishBase extends Object implements EstablishState
Modifier and Type | Class and Description |
---|---|
protected static class |
EstablishBase.State |
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() |
public static final net.i2p.router.transport.ntcp.EstablishBase.VerifiedEstablishState VERIFIED
public static final net.i2p.router.transport.ntcp.EstablishBase.FailedEstablishState FAILED
protected final RouterContext _context
protected final Log _log
protected final byte[] _X
protected final byte[] _Y
protected transient long _peerSkew
protected byte[] _prevEncrypted
protected int _received
protected final NTCPTransport _transport
protected final NTCPConnection _con
protected static final int MIN_RI_SIZE
protected static final int MAX_RI_SIZE
protected static final int AES_SIZE
protected static final int XY_SIZE
protected final Object _stateLock
protected volatile EstablishBase.State _state
protected static final Set<EstablishBase.State> STATES_DONE
protected EstablishBase(RouterContext ctx, NTCPTransport transport, NTCPConnection con)
protected void changeState(EstablishBase.State state)
public void receive(ByteBuffer src)
receive
in interface EstablishState
public void prepareOutbound()
prepareOutbound
in interface EstablishState
public boolean isCorrupt()
isCorrupt
in interface EstablishState
public boolean isComplete()
isComplete
in interface EstablishState
public abstract int getVersion()
getVersion
in interface EstablishState
public void close(String reason, Exception e)
close
in interface EstablishState
e
- may be nullprotected void fail(String reason)
protected void releaseBufs(boolean isVerified)
protected String prefix()