public abstract class TunnelBuildMessageBase extends I2NPMessageImpl
I2NPMessageImpl.Builder| Modifier and Type | Field and Description |
|---|---|
protected EncryptedBuildRecord[] | _recordsThe encrypted records, one per hop, or null until readMessage(). |
static int | MAX_RECORD_COUNTMaximum number of records in any tunnel build message (8 hops). |
protected int | RECORD_COUNTNumber of records in _records, zero if not yet set. |
static int | RECORD_SIZESize in bytes of one encrypted record: 16 byte IV + 512 byte payload. |
_context, _expiration, _log, CHECKSUM_LENGTH, DEFAULT_EXPIRATION_MS, HEADER_LENGTHMAX_ID_VALUE, MAX_SIZE| Modifier | Constructor and Description |
|---|---|
| TunnelBuildMessageBase(I2PAppContext context)Create with the default number of records. |
protected | TunnelBuildMessageBase(I2PAppContext context,
int records) |
| Modifier and Type | Method and Description |
|---|---|
protected int | calculateWrittenLength()Written length of the message body: one record size per record. |
EncryptedBuildRecord | getRecord(int index)Build record at the given index, may be null. |
int | getRecordCount() |
void | readMessage(byte[] data,
int offset,
int dataSize,
int type)Read the records from a byte array. |
void | setRecord(int index,
EncryptedBuildRecord record)Store a build record. |
protected int | writeMessageBody(byte[] out,
int curIndex)Write the records to the output array, starting at the given index. |
createMessage, fromRawByteArray, fromRawByteArrayNTCP2, getMessageExpiration, getMessageSize, getRawMessageSize, getUniqueId, getUniqueId, readBytes, readBytes, readMessage, setMessageExpiration, setUniqueId, toByteArray, toByteArray, toByteArray, toRawByteArray, toRawByteArrayNTCP2clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTypeprotected EncryptedBuildRecord[] _records
public static final int MAX_RECORD_COUNT
protected int RECORD_COUNT
public static final int RECORD_SIZE
public TunnelBuildMessageBase(I2PAppContext context)
protected TunnelBuildMessageBase(I2PAppContext context, int records)
protected int calculateWrittenLength()
calculateWrittenLength in class I2NPMessageImplpublic EncryptedBuildRecord getRecord(int index)
index - the indexpublic int getRecordCount()
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 setRecord(int index,
EncryptedBuildRecord record)record - may be nullindex - the indexprotected int writeMessageBody(byte[] out,
int curIndex)
throws I2NPMessageExceptionwriteMessageBody in class I2NPMessageImplI2NPMessageException