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

public static class SSU2Payload.PeerTestBlockextends SSU2Payload.Block
Block containing peer test data. Used for network reachability testing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The peer test counter.
    private final byte[]
    Extra data of the test.
    private final Hash
    The hash echoed in the test.
    private final int
    The peer test nonce.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PeerTestBlock(int msgNum, int code, Hash hash, byte[] data)
    Wrap a peer test as a block.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    int
    The data length of this block.
    int
    writeData(byte[] tgt, int off)
    Write this block's 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

    • n

      private final int n
      The peer test nonce.
    • c

      private final int c
      The peer test counter.
    • h

      private final Hash h
      The hash echoed in the test.
    • d

      private final byte[] d
      Extra data of the test.
  • Constructor Details

    • PeerTestBlock

      public PeerTestBlock(int msgNum, int code, Hash hash, byte[] data)
      Wrap a peer test as a block.
      Parameters:
      msgNum - the message number the test answers
      code - the test result code
      hash - may be null
      data - the test payload bytes
  • Method Details

    • getDataLength

      public int getDataLength()
      The data length of this block.
      Specified by:
      getDataLength in class SSU2Payload.Block
      Returns:
      the data length
    • writeData

      public int writeData(byte[] tgt, int off)
      Write this block's 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