java.lang.Object
net.i2p.router.crypto.ratchet.RatchetPayload.Block
net.i2p.router.crypto.ratchet.RatchetPayload.AckBlock
Enclosing class:
RatchetPayload

public static class RatchetPayload.AckBlockextends RatchetPayload.Block
Acknowledgment block for ratchet payload.
  • Field Details

    • data

      private byte[] data
      The message number bytes sent in the payload.
  • Constructor Details

    • AckBlock

      public AckBlock(int keyID, int n)
      Builds an ACK block for a single key ID and count.
      Parameters:
      keyID - the ratchet key ID being acknowledged
      n - the message count acknowledged for that key
    • AckBlock

      public AckBlock(List<Integer> acks)
      ACK block for multiple key IDs and counts.
      Parameters:
      acks - each is id << 16 | n
  • Method Details

    • setAcks

      void setAcks(List<Integer> acks)
      Set the ACK data, for reuse. Reallocates only if the size changes.
      Parameters:
      acks - each is id << 16 | n
    • getDataLength

      public int getDataLength()
      Data length of the block.
      Specified by:
      getDataLength in class RatchetPayload.Block
      Returns:
      the size of the block, NOT including the 3 byte header (type and size)
    • writeData

      public int writeData(byte[] tgt, int off)
      Writes the block to the output buffer at the given offset.
      Specified by:
      writeData in class RatchetPayload.Block
      Parameters:
      tgt - the target buffer
      off - the offset in tgt where the block data starts
      Returns:
      the offset just past the data written to tgt