java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.AckBlock
- Enclosing class:
SSU2Payload
Block containing acknowledgment data. Used to acknowledge receipt of packets.
Field Summary
Constructor Summary
ConstructorsConstructorDescriptionAckBlock(long thru, int acnt, byte[] ranges, int rangeCount) Create an acknowledgment block.Method Summary
All MethodsMethods inherited from class SSU2Payload.Block
getTotalLength, getType, write
Field Details
t
private final long tThe message id being acked.a
private final int aBytes of capacity being acked.r
private final byte[] rExtra data of the ack, if any.rc
private final int rcReceive 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 numberacnt- number of additional acks (max 255)ranges- the ack ranges, two bytes per range, alternating ack and nackrangeCount- 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:
getDataLengthin classSSU2Payload.Block- Returns:
- the data length
writeData
public int writeData(byte[] tgt, int off) Write the ACK block data to the target array.- Specified by:
writeDatain classSSU2Payload.Block- Parameters:
tgt- target array to write tooff- offset in the target array- Returns:
- the new offset after writing
toString
String representation of this ACK block.- Overrides:
toStringin classSSU2Payload.Block