java.lang.Object
net.i2p.router.transport.udp.SSU2Header.Header
- Enclosing class:
SSU2Header
A temporary structure returned from trial decrypt, with methods to access the fields.
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionlongAvailable in all header types.byte[]X25519 ephemeral public key, present only in handshake headers.intLong header flags byte, present only in long headers.intgetNetID()Network ID, present only in long headers.longAvailable in all header types.intShort header flags byte, present only in short headers.longSource connection ID, present only in long headers.longgetToken()Token, present only in long headers.intgetType()Available in all header types.intSSU2 protocol version, present only in long headers.toString()String representation of this header.
Field Details
data
public final byte[] dataThe raw header bytes.
Constructor Details
Header
public Header(int len) Create a Header with the given size.- Parameters:
len- the number of raw header bytes to allocate, one of the SHORT_HEADER_SIZE, LONG_HEADER_SIZE or SESSION_HEADER_SIZE values
Method Details
getDestConnID
public long getDestConnID()Available in all header types.- Returns:
- the destination connection ID, 0 if the header is all zeros
getPacketNumber
public long getPacketNumber()Available in all header types.- Returns:
- the packet number, for an I2P header sent before data phase it may be 0
getType
public int getType()Available in all header types.- Returns:
- the message type byte
getShortHeaderFlags
public int getShortHeaderFlags()Short header flags byte, present only in short headers.- Returns:
- the short header flags byte
getVersion
public int getVersion()SSU2 protocol version, present only in long headers.- Returns:
- the protocol version byte
getNetID
public int getNetID()Network ID, present only in long headers.- Returns:
- the network ID byte
getHandshakeHeaderFlags
public int getHandshakeHeaderFlags()Long header flags byte, present only in long headers.- Returns:
- the long header flags byte
getSrcConnID
public long getSrcConnID()Source connection ID, present only in long headers.- Returns:
- the source connection ID, 0 if absent
getToken
public long getToken()Token, present only in long headers.- Returns:
- the 8-byte token as a long, 0 if absent
getEphemeralKey
public byte[] getEphemeralKey()X25519 ephemeral public key, present only in handshake headers.- Returns:
- a newly allocated copy of the 32-byte ephemeral public key
toString