class OutboundNTCP2State extends Object implements EstablishState
| Modifier and Type | Field and Description |
|---|---|
static int | IV_SIZEIV_SIZE. |
static int | KEY_SIZEKEY_SIZE. |
static int | MAC_SIZEMAC_SIZE. |
static long | MAX_SKEWin SECONDS |
static int | MSG1_SIZENTCP2 message 1 size in bytes (64). |
static int | MSG2_SIZENTCP2 message 2 size in bytes. |
static int | MSG3P1_SIZENTCP2 message 3 part 1 size in bytes (48). |
static int | OPTIONS1_SIZEOptions block size in bytes. |
static int | OPTIONS2_SIZEOptions block size in bytes. |
static byte[] | ZEROKEYZEROKEY. |
| Constructor and Description |
|---|
OutboundNTCP2State(RouterContext ctx,
NTCPTransport transport,
NTCPConnection con)Create a new outbound NTCP2 state. |
| Modifier and Type | Method and Description |
|---|---|
void | close(String reason,
Exception e)Release resources on timeout. |
protected void | fail(String reason)fail. |
protected void | fail(String reason,
Exception e)fail. |
protected void | fail(String reason,
Exception e,
boolean bySkew)fail. |
(package private) static byte[][] | generateSipHashKeys(RouterContext ctx,
HandshakeState state)KDF for SipHash |
String | getFailReason()Get the failure reason if the handshake failed |
int | getVersion()Get the NTCP version |
boolean | isComplete()Don't synchronize this, deadlocks all over. |
boolean | isCorrupt()did the handshake fail for some reason? |
boolean | isInitialState()Check if the connection is in initial state and ready for prepareOutbound() |
boolean | isPrepareOutboundCalled()Check if the connection is in a state where prepareOutbound() has already been called
to avoid duplicate calls that cause IllegalStateException |
void | prepareOutbound()We are Alice. |
void | receive(ByteBuffer src)Parse the contents of the buffer as part of the handshake. |
String | toString()toString. |
public static final int IV_SIZE
public static final int KEY_SIZE
public static final int MAC_SIZE
public static final long MAX_SKEW
public static final int MSG1_SIZE
public static final int MSG2_SIZE
public static final int MSG3P1_SIZE
public static final int OPTIONS1_SIZE
public static final int OPTIONS2_SIZE
public static final byte[] ZEROKEY
public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con)
ctx - router contexttransport - NTCP transportcon - connectionIllegalArgumentException - on bad address in the connectionpublic void close(String reason, Exception e)
close in interface EstablishStatee - may be nullreason - the reasonprotected void fail(String reason)
static byte[][] generateSipHashKeys(RouterContext ctx, HandshakeState state)
public String getFailReason()
getFailReason in interface EstablishStatepublic int getVersion()
getVersion in interface EstablishStatepublic boolean isComplete()
isComplete in interface EstablishStatepublic boolean isCorrupt()
isCorrupt in interface EstablishStatepublic boolean isInitialState()
public boolean isPrepareOutboundCalled()
public void prepareOutbound()
prepareOutbound in interface EstablishStateIllegalStateExceptionpublic void receive(ByteBuffer src)
receive in interface EstablishStatesrc - the buffer to parse