java.lang.Object
net.i2p.router.transport.udp.SSU2Payload.Block
net.i2p.router.transport.udp.SSU2Payload.RIBlock
- Enclosing class:
SSU2Payload
Block containing router information data. Used to exchange router information during session establishment.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]The router info bytes.private final intLength of the router info bytes.private final intOffset of the router info in the block.private final booleanFlag bits of the block.private final intFragment number of the block.private final intFragment total of the block.private final booleanWhether the router info is gzipped.Constructor Summary
Method Summary
All MethodsModifier and TypeMethodDescriptionintReturn the data length including the 2 byte header.intwriteData(byte[] tgt, int off) Write the RouterInfo block data to the target array.Methods inherited from class SSU2Payload.Block
getTotalLength, getType, toString, write
Field Details
data
private final byte[] dataThe router info bytes.doff
private final int doffOffset of the router info in the block.dlen
private final int dlenLength of the router info bytes.f
private final boolean fFlag bits of the block.gz
private final boolean gzWhether the router info is gzipped.fr
private final int frFragment number of the block.frt
private final int frtFragment total of the block.
Constructor Details
RIBlock
public RIBlock(byte[] ridata, boolean flood, boolean gzipped) Create a complete (non-fragmented) RouterInfo block.- Parameters:
ridata- the raw RouterInfo dataflood- true if this is a floodfill routergzipped- true if data is gzipped
RIBlock
public RIBlock(byte[] ridata, int off, int len, boolean flood, boolean gzipped, int frag, int total) Create a fragment of a RouterInfo block.- Parameters:
ridata- the raw RouterInfo dataoff- offset in the datalen- length of the fragmentflood- true if this is a floodfill routergzipped- true if data is gzippedfrag- fragment number (0-based)total- total number of fragments
Method Details
getDataLength
public int getDataLength()Return the data length including the 2 byte header.- Specified by:
getDataLengthin classSSU2Payload.Block- Returns:
- the data length
writeData
public int writeData(byte[] tgt, int off) Write the RouterInfo 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