java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.RIBlock
Enclosing class:
SSU2Payload

public static class SSU2Payload.RIBlockextends SSU2Payload.Block
Block containing router information data. Used to exchange router information during session establishment.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final byte[]
    The router info bytes.
    private final int
    Length of the router info bytes.
    private final int
    Offset of the router info in the block.
    private final boolean
    Flag bits of the block.
    private final int
    Fragment number of the block.
    private final int
    Fragment total of the block.
    private final boolean
    Whether the router info is gzipped.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RIBlock(byte[] ridata, boolean flood, boolean gzipped)
    Create a complete (non-fragmented) RouterInfo block.
    RIBlock(byte[] ridata, int off, int len, boolean flood, boolean gzipped, int frag, int total)
    Create a fragment of a RouterInfo block.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    int
    Return the data length including the 2 byte header.
    int
    writeData(byte[] tgt, int off)
    Write the RouterInfo block data to the target array.

    Methods inherited from class SSU2Payload.Block

    getTotalLength, getType, toString, write
    Modifier and Type
    Method
    Description
    int
    Return the total size of the block, including the 3 byte header.
    int
    The block type.
    String representation of this block.
    int
    write(byte[] tgt, int off)
    Write the block to the target array, returning the new offset.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • data

      private final byte[] data
      The router info bytes.
    • doff

      private final int doff
      Offset of the router info in the block.
    • dlen

      private final int dlen
      Length of the router info bytes.
    • f

      private final boolean f
      Flag bits of the block.
    • gz

      private final boolean gz
      Whether the router info is gzipped.
    • fr

      private final int fr
      Fragment number of the block.
    • frt

      private final int frt
      Fragment total of the block.
  • Constructor Details

    • RIBlock

      public RIBlock(byte[] ridata, boolean flood, boolean gzipped)
      Create a complete (non-fragmented) RouterInfo block.
      Parameters:
      ridata - the raw RouterInfo data
      flood - true if this is a floodfill router
      gzipped - true if data is gzipped
    • RIBlock

      public RIBlock(byte[] ridata, int off, int len, boolean flood, boolean gzipped, int frag, int total)
      Create a fragment of a RouterInfo block.
      Parameters:
      ridata - the raw RouterInfo data
      off - offset in the data
      len - length of the fragment
      flood - true if this is a floodfill router
      gzipped - true if data is gzipped
      frag - fragment number (0-based)
      total - total number of fragments
  • Method Details

    • getDataLength

      public int getDataLength()
      Return the data length including the 2 byte header.
      Specified by:
      getDataLength in class SSU2Payload.Block
      Returns:
      the data length
    • writeData

      public int writeData(byte[] tgt, int off)
      Write the RouterInfo block data to the target array.
      Specified by:
      writeData in class SSU2Payload.Block
      Parameters:
      tgt - target array to write to
      off - offset in the target array
      Returns:
      the new offset after writing