public class TunnelGatewayMessage extends FastI2NPMessageImpl
I2NPMessageImpl.Builder| Modifier and Type | Field and Description |
|---|---|
static int | MESSAGE_TYPEMessage type ID for this I2NP message |
_checksum, _hasChecksum_context, _expiration, _log, CHECKSUM_LENGTH, DEFAULT_EXPIRATION_MS, HEADER_LENGTHMAX_ID_VALUE, MAX_SIZE| Constructor and Description |
|---|
TunnelGatewayMessage(I2PAppContext context)Constructor with 10-second message expiration from context clock. |
| Modifier and Type | Method and Description |
|---|---|
protected int | calculateWrittenLength()Calculate the serialized length of this message |
boolean | equals(Object object)Two TunnelGatewayMessages are equal if they have the same tunnel ID and message content. |
I2NPMessage | getMessage()Warning, at the IBGW, where the message was read in,
this will be an UnknownI2NPMessage. |
TunnelId | getTunnelId()Return the tunnelId |
int | getType()Return the type |
int | hashCode()Hash based on tunnel ID and embedded message. |
void | readMessage(byte[] data,
int offset,
int dataSize,
int type)Read and parse the message from raw data into fields. |
void | readMessage(byte[] data,
int offset,
int dataSize,
int type,
I2NPMessageHandler handler)Note that for efficiency at the IBGW, this does not fully deserialize the included
I2NP Message. |
void | setMessage(I2NPMessage msg) |
void | setTunnelId(TunnelId id) |
String | toString()Label with message ID, tunnel ID, and embedded message for logging. |
protected int | writeMessageBody(byte[] out,
int curIndex)write the message body to the output array, starting at the given index |
readBytes, toByteArray, toByteArrayWithSavedChecksumcreateMessage, fromRawByteArray, fromRawByteArrayNTCP2, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, getUniqueId, readBytes, setMessageExpiration, setUniqueId, toByteArray, toByteArray, toRawByteArray, toRawByteArrayNTCP2public static final int MESSAGE_TYPE
public TunnelGatewayMessage(I2PAppContext context)
protected int calculateWrittenLength()
calculateWrittenLength in class I2NPMessageImplpublic boolean equals(Object object)
public I2NPMessage getMessage()
public TunnelId getTunnelId()
public int getType()
public int hashCode()
public void readMessage(byte[] data,
int offset,
int dataSize,
int type)
throws I2NPMessageExceptiondata - data to read fromoffset - where to start in the data arraydataSize - how long into the data to readtype - I2NP message typeI2NPMessageException - if the stream doesn't contain a valid message
that this class can read.public void readMessage(byte[] data,
int offset,
int dataSize,
int type,
I2NPMessageHandler handler)
throws I2NPMessageExceptionreadMessage in interface I2NPMessagereadMessage in class I2NPMessageImplhandler - unused, may be nullI2NPMessageExceptionpublic void setMessage(I2NPMessage msg)
IllegalStateException - if msg previously set, to protect saved checksumpublic void setTunnelId(TunnelId id)
IllegalStateException - if id previously set, to protect saved checksumpublic String toString()
protected int writeMessageBody(byte[] out,
int curIndex)
throws I2NPMessageExceptionwriteMessageBody in class I2NPMessageImplI2NPMessageException