java.lang.Object
net.i2p.client.datagram.Datagram3

public class Datagram3extends Object
Class for creating and loading I2P repliable datagrams version 3. Ref: Proposal 163.
+----+----+----+----+----+----+----+----+
|                                       |
+            fromHash                   +
|                                       |
+                                       +
|                                       |
+----+----+----+----+----+----+----+----+
|  flags  |     options (optional)      |
+----+----+                             +
~                                       ~
~                                       ~
+----+----+----+----+----+----+----+----+
|                                       |
~            payload                    ~
~                                       ~
|                                       |
+----+----+----+----+----+----+----+----+
  • Field Details

    • _from

      private final Hash _from
      The sender's hash.
    • _payload

      private final byte[] _payload
      The data carried by the datagram.
    • _options

      private final Properties _options
      The options sent along with the datagram.
    • MIN_DGRAM_SIZE

      private static final int MIN_DGRAM_SIZE
      Smallest datagram that can be parsed.
      See Also:
    • MAX_DGRAM_BUFSIZE

      private static final int MAX_DGRAM_BUFSIZE
      Largest datagram buffer allocated.
      See Also:
    • VERSION_MASK

      private static final byte VERSION_MASK
      Mask for the version bits of the first byte.
      See Also:
    • OPTIONS

      private static final byte OPTIONS
      Flag saying the options follow.
      See Also:
    • VERSION

      private static final byte VERSION
      The version of this datagram format.
      See Also:
  • Constructor Details

  • Method Details

    • make

      public static byte[] make(I2PAppContext ctx, I2PSession session, byte[] payload) throws DataFormatException
      Make a repliable I2P datagram3 containing the specified payload.
      Parameters:
      ctx - non-null
      session - non-null
      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, Properties options) throws DataFormatException
      Make a repliable I2P datagram3 containing the specified payload.
      Parameters:
      ctx - non-null
      session - non-null
      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 Datagram3 load(I2PAppContext ctx, I2PSession session, byte[] dgram) throws DataFormatException
      Load an I2P repliable datagram3.
      Parameters:
      ctx - non-null
      session - non-null
      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 format
    • getPayload

      public byte[] getPayload()
      The payload carried by an I2P repliable datagram (previously loaded with the load() method).
      Returns:
      A byte array containing the datagram payload
    • getSender

      public Hash getSender()
      The sender of an I2P repliable datagram (previously loaded with the load() method).
      Returns:
      The Hash of the Destination of the I2P repliable datagram sender
    • getOptions

      public Properties getOptions()
      The options of an I2P repliable datagram (previously loaded with the load() method), if any.
      Returns:
      options or null