class OutboundNTCP2State extends Object implements EstablishState
| Modifier and Type | Field and Description |
|---|---|
static int |
IV_SIZE |
static int |
KEY_SIZE |
static int |
MAC_SIZE |
static long |
MAX_SKEW
in SECONDS
|
static int |
MSG1_SIZE
64
|
static int |
MSG2_SIZE |
static int |
MSG3P1_SIZE
48
|
static int |
OPTIONS1_SIZE |
static int |
OPTIONS2_SIZE |
static int |
TOTAL1_MAX
one less than 288 byte NTCP1 msg 1
|
static byte[] |
ZEROKEY |
| Constructor and Description |
|---|
OutboundNTCP2State(RouterContext ctx,
NTCPTransport transport,
NTCPConnection con) |
| Modifier and Type | Method and Description |
|---|---|
void |
close(String reason,
Exception e)
Release resources on timeout.
|
protected void |
fail(String reason) |
protected void |
fail(String reason,
Exception e) |
protected void |
fail(String reason,
Exception e,
boolean bySkew) |
(package private) static byte[][] |
generateSipHashKeys(RouterContext ctx,
HandshakeState state)
KDF for SipHash
|
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() |
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 int TOTAL1_MAX
public static final byte[] ZEROKEY
public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con)
IllegalArgumentException - on bad address in the conpublic void close(String reason, Exception e)
close in interface EstablishStatee - may be nullprotected void fail(String reason)
static byte[][] generateSipHashKeys(RouterContext ctx, HandshakeState state)
public 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 EstablishState