All Implemented Interfaces:
I2NPMessage

public class ShortTunnelBuildReplyMessageextends TunnelBuildReplyMessage
Internal use only, to convert an inbound STBM to a reply. Never serialized/deserialized/sent/received. See BuildHandler and BuildReplyHandler.
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      Impossible value, more than 1 byte.
      See Also:
    • SHORT_RECORD_SIZE

      public static final int SHORT_RECORD_SIZE
      Byte length every short build record in this reply must have.
      See Also:
  • Constructor Details

    • ShortTunnelBuildReplyMessage

      public ShortTunnelBuildReplyMessage(I2PAppContext context, int records)
      Creates a reply with preallocated slots for the given number of records.
      Parameters:
      context - the context owning the reply's random source and clock
      records - number of short build records to preallocate slots for
  • Method Details

    • setRecord

      public void setRecord(int index, EncryptedBuildRecord record)
      Store a build record, checking its length.
      Overrides:
      setRecord in class TunnelBuildMessageBase
      Parameters:
      index - the zero-based position of the record in the record array
      record - must be ShortEncryptedBuildRecord or null
    • calculateWrittenLength

      protected int calculateWrittenLength()
      Written length of the message body, zero since never serialized.
      Overrides:
      calculateWrittenLength in class TunnelBuildMessageBase
      Returns:
      the number of bytes the body will occupy once serialized
    • getType

      public int getType()
      I2NP message type of a short tunnel build reply, never sent.
      Specified by:
      getType in interface I2NPMessage
      Overrides:
      getType in class TunnelBuildReplyMessage
      Returns:
      MESSAGE_TYPE, 999
    • readMessage

      public void readMessage(byte[] data, int offset, int dataSize, int type) throws I2NPMessageException
      Unsupported; the reply is never deserialized.
      Specified by:
      readMessage in interface I2NPMessage
      Overrides:
      readMessage in class TunnelBuildMessageBase
      Parameters:
      data - data to read from
      offset - where to start in the data array
      dataSize - how long into the data to read
      type - I2NP message type
      Throws:
      UnsupportedOperationException - always, nothing constructs this from wire data
      I2NPMessageException - if the stream doesn't contain a valid message that this class can read.
    • writeMessageBody

      protected int writeMessageBody(byte[] out, int curIndex) throws I2NPMessageException
      Unsupported; the reply is never serialized.
      Overrides:
      writeMessageBody in class TunnelBuildMessageBase
      Parameters:
      out - the buffer to serialize the body into
      curIndex - the offset into out at which to begin writing; leave room for the signature where the header format calls for one
      Returns:
      the index into the array after the last byte written (NOT the length)
      Throws:
      UnsupportedOperationException - always, nothing puts this type on the wire
      I2NPMessageException - if the body cannot be serialized into out, because it is too small or a field is unserializable
    • toString

      public String toString()
      String form for debugging, showing the id and record count.
      Overrides:
      toString in class TunnelBuildReplyMessage