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

public static class SSU2Payload.AckBlockextends SSU2Payload.Block
Block containing acknowledgment data. Used to acknowledge receipt of packets.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    Bytes of capacity being acked.
    private final byte[]
    Extra data of the ack, if any.
    private final int
    Receive time of the acked message.
    private final long
    The message id being acked.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AckBlock(long thru, int acnt, byte[] ranges, int rangeCount)
    Create an acknowledgment block.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    int
    Return the ACK data length (5 byte header + 2 bytes per range).
    String representation of this ACK block.
    int
    writeData(byte[] tgt, int off)
    Write the ACK block data to the target array.

    Methods inherited from class SSU2Payload.Block

    getTotalLength, getType, write
    Modifier and Type
    Method
    Description
    int
    Return the total size of the block, including the 3 byte header.
    int
    The block type.
    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

    • t

      private final long t
      The message id being acked.
    • a

      private final int a
      Bytes of capacity being acked.
    • r

      private final byte[] r
      Extra data of the ack, if any.
    • rc

      private final int rc
      Receive time of the acked message.
  • Constructor Details

    • AckBlock

      public AckBlock(long thru, int acnt, byte[] ranges, int rangeCount)
      Create an acknowledgment block.
      Parameters:
      thru - highest contiguous sequence number
      acnt - number of additional acks (max 255)
      ranges - the ack ranges, two bytes per range, alternating ack and nack
      rangeCount - number of range pairs (ranges length / 2)
  • Method Details

    • getDataLength

      public int getDataLength()
      Return the ACK data length (5 byte header + 2 bytes per range).
      Specified by:
      getDataLength in class SSU2Payload.Block
      Returns:
      the data length
    • writeData

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

      public String toString()
      String representation of this ACK block.
      Overrides:
      toString in class SSU2Payload.Block