Package net.i2p.router.transport.udp
Class SSU2Payload
- java.lang.Object
-
- net.i2p.router.transport.udp.SSU2Payload
-
class SSU2Payload extends Object
SSU2 Payload generation and parsing- Since:
- 0.9.54
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static int
BLOCK_HEADER_SIZE
static int
BLOCK_TERMINATION
-
Constructor Summary
Constructors Constructor Description SSU2Payload()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
processPayload(I2PAppContext ctx, SSU2Payload.PayloadCallback cb, byte[] payload, int off, int length, boolean isHandshake, RemoteHostId from)
Incoming payload.static int
writePayload(byte[] payload, int off, List<SSU2Payload.Block> blocks)
-
-
-
Field Detail
-
BLOCK_HEADER_SIZE
public static final int BLOCK_HEADER_SIZE
- See Also:
- Constant Field Values
-
BLOCK_TERMINATION
public static final int BLOCK_TERMINATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
processPayload
public static int processPayload(I2PAppContext ctx, SSU2Payload.PayloadCallback cb, byte[] payload, int off, int length, boolean isHandshake, RemoteHostId from) throws IOException, DataFormatException, I2NPMessageException
Incoming payload. Calls the callback for each received block.- Parameters:
isHandshake
- true for Token Req, Retry, Sess Req, Sess Created; false for Sess Confirmedfrom
- for path challenge/response only, may be null- Returns:
- number of blocks processed
- Throws:
IOException
- on major errorsDataFormatException
- on parsing of individual blocksI2NPMessageException
- on parsing of I2NP block
-
writePayload
public static int writePayload(byte[] payload, int off, List<SSU2Payload.Block> blocks)
- Parameters:
payload
- writes to it starting at off- Returns:
- the new offset
-
-