Package net.i2p.client.datagram
Class Datagram2
- java.lang.Object
-
- net.i2p.client.datagram.Datagram2
-
public class Datagram2 extends Object
Class for creating and loading I2P repliable datagrams version 2. Ref: Proposal 163+----+----+----+----+----+----+----+----+ | | ~ from ~ ~ ~ | | +----+----+----+----+----+----+----+----+ | flags | options (optional) | +----+----+ + ~ ~ ~ ~ +----+----+----+----+----+----+----+----+ | | ~ offline_signature (optional) ~ ~ expires, sigtype, pubkey, offsig ~ | | +----+----+----+----+----+----+----+----+ | | ~ payload ~ ~ ~ | | +----+----+----+----+----+----+----+----+ | | ~ signature ~ ~ ~ | | +----+----+----+----+----+----+----+----+
- Since:
- 0.9.66
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Properties
getOptions()
Get the options of an I2P repliable datagram (previously loaded with the load() method), if anybyte[]
getPayload()
Get the payload carried by an I2P repliable datagram (previously loaded with the load() method)Destination
getSender()
Get the sender of an I2P repliable datagram (previously loaded with the load() method)static Datagram2
load(I2PAppContext ctx, I2PSession session, byte[] dgram)
Load an I2P repliable datagram and verify the signature.static byte[]
make(I2PAppContext ctx, I2PSession session, byte[] payload, Hash tohash)
Make a repliable I2P datagram2 containing the specified payload.static byte[]
make(I2PAppContext ctx, I2PSession session, byte[] payload, Hash tohash, Properties options)
Make a repliable I2P datagram2 containing the specified payload.
-
-
-
Method Detail
-
make
public static byte[] make(I2PAppContext ctx, I2PSession session, byte[] payload, Hash tohash) throws DataFormatException
Make a repliable I2P datagram2 containing the specified payload.- Parameters:
payload
- non-null Bytes to be contained in the I2P datagram.- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- if payload is too big
-
make
public static byte[] make(I2PAppContext ctx, I2PSession session, byte[] payload, Hash tohash, Properties options) throws DataFormatException
Make a repliable I2P datagram2 containing the specified payload.- Parameters:
payload
- non-null Bytes to be contained in the I2P datagram.options
- may be null- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- if payload is too big
-
load
public static Datagram2 load(I2PAppContext ctx, I2PSession session, byte[] dgram) throws DataFormatException, I2PInvalidDatagramException
Load an I2P repliable datagram and verify the signature.- Parameters:
dgram
- non-null I2P repliable datagram to be loaded- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- If there is an error in the datagram formatI2PInvalidDatagramException
- If the signature fails
-
getPayload
public byte[] getPayload()
Get the payload carried by an I2P repliable datagram (previously loaded with the load() method)- Returns:
- A byte array containing the datagram payload
-
getSender
public Destination getSender()
Get the sender of an I2P repliable datagram (previously loaded with the load() method)- Returns:
- The Destination of the I2P repliable datagram sender
-
getOptions
public Properties getOptions()
Get the options of an I2P repliable datagram (previously loaded with the load() method), if any- Returns:
- options or null
-
-