Package net.i2p.router.crypto.ratchet
Class RatchetPayload
java.lang.Object
net.i2p.router.crypto.ratchet.RatchetPayload
class RatchetPayload extends Object
Ratchet payload generation and parsing
- Since:
- 0.9.44 adapted from NTCP2Payload
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RatchetPayload.AckBlock
static class
RatchetPayload.AckRequestBlock
static class
RatchetPayload.Block
Base class for blocks to be transmitted.static class
RatchetPayload.DateTimeBlock
static class
RatchetPayload.GarlicBlock
static class
RatchetPayload.NextKeyBlock
static class
RatchetPayload.OptionsBlock
static class
RatchetPayload.PaddingBlock
static interface
RatchetPayload.PayloadCallback
For all callbacks, recommend throwing exceptions only from the handshake.static class
RatchetPayload.PNBlock
static class
RatchetPayload.TerminationBlock
-
Field Summary
Fields Modifier and Type Field Description static int
BLOCK_HEADER_SIZE
-
Constructor Summary
Constructors Constructor Description RatchetPayload()
-
Method Summary
Modifier and Type Method Description static int
processPayload(I2PAppContext ctx, RatchetPayload.PayloadCallback cb, byte[] payload, int off, int length, boolean isHandshake)
Incoming payload.static int
writePayload(byte[] payload, int off, List<RatchetPayload.Block> blocks)
-
Field Details
-
BLOCK_HEADER_SIZE
public static final int BLOCK_HEADER_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
RatchetPayload
RatchetPayload()
-
-
Method Details
-
processPayload
public static int processPayload(I2PAppContext ctx, RatchetPayload.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
-