Package net.i2p.router.transport.ntcp
Class NTCP2Payload
java.lang.Object
net.i2p.router.transport.ntcp.NTCP2Payload
class NTCP2Payload extends Object
NTCP2 Payload generation and parsing
- Since:
- 0.9.35
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NTCP2Payload.Block
Base class for blocks to be transmitted.static class
NTCP2Payload.DateTimeBlock
static class
NTCP2Payload.I2NPBlock
static class
NTCP2Payload.OptionsBlock
static class
NTCP2Payload.PaddingBlock
static interface
NTCP2Payload.PayloadCallback
For all callbacks, recommend throwing exceptions only from the handshake.static class
NTCP2Payload.RIBlock
static class
NTCP2Payload.TerminationBlock
-
Field Summary
Fields Modifier and Type Field Description static int
BLOCK_HEADER_SIZE
-
Constructor Summary
Constructors Constructor Description NTCP2Payload()
-
Method Summary
Modifier and Type Method Description static int
processPayload(I2PAppContext ctx, NTCP2Payload.PayloadCallback cb, byte[] payload, int off, int length, boolean isHandshake)
Incoming payload.static int
writePayload(byte[] payload, int off, List<NTCP2Payload.Block> blocks)
-
Field Details
-
BLOCK_HEADER_SIZE
public static final int BLOCK_HEADER_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
NTCP2Payload
NTCP2Payload()
-
-
Method Details
-
processPayload
public static int processPayload(I2PAppContext ctx, NTCP2Payload.PayloadCallback cb, byte[] payload, int off, int length, boolean isHandshake) throws IOException, DataFormatException, I2NPMessageExceptionIncoming payload. Calls the callback for each received block.- Returns:
- number of blocks processed
- Throws:
IOException
- on major errorsDataFormatException
- on parsing of individual blocksI2NPMessageException
- on parsing of I2NP block
-
writePayload
- Parameters:
payload
- writes to it starting at off- Returns:
- the new offset
-