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

public static class SSU2Payload.AddressBlockextends SSU2Payload.Block
Block containing IP address and port information. Used to exchange transport addresses.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final byte[]
    The advertised IP address bytes.
    private final int
    The advertised port.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AddressBlock(byte[] ip, int port)
    Create an address block.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    int
    Return the address data length (2 byte port + IP bytes).
    int
    writeData(byte[] tgt, int off)
    Write the address 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

    • i

      private final byte[] i
      The advertised IP address bytes.
    • p

      private final int p
      The advertised port.
  • Constructor Details

    • AddressBlock

      public AddressBlock(byte[] ip, int port)
      Create an address block.
      Parameters:
      ip - the IP address bytes (IPv4 = 4 bytes, IPv6 = 16 bytes)
      port - the port number
  • Method Details

    • getDataLength

      public int getDataLength()
      Return the address data length (2 byte port + IP bytes).
      Specified by:
      getDataLength in class SSU2Payload.Block
      Returns:
      the data length
    • writeData

      public int writeData(byte[] tgt, int off)
      Write the address 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