Interface I2CPMessage

All Known Implementing Classes:
BandwidthLimitsMessage, BlindingInfoMessage, CreateLeaseSet2Message, CreateLeaseSetMessage, CreateSessionMessage, DestLookupMessage, DestReplyMessage, DestroySessionMessage, DisconnectMessage, GetBandwidthLimitsMessage, GetDateMessage, HostLookupMessage, HostReplyMessage, I2CPMessageImpl, MessagePayloadMessage, MessageStatusMessage, PoisonI2CPMessage, ReceiveMessageBeginMessage, ReceiveMessageEndMessage, ReconfigureSessionMessage, ReportAbuseMessage, RequestLeaseSetMessage, RequestVariableLeaseSetMessage, SendMessageExpiresMessage, SendMessageMessage, SessionStatusMessage, SetDateMessage

public interface I2CPMessage
Defines the base functionality of API messages As of 0.9.48, does NOT extend DataStructure.
Author:
jrandom
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages
    void
    Read the contents from the input stream into the current class's format.
    void
    readMessage(InputStream in, int size, int type)
    Read the contents from the input stream into the current class's format.
    Return the SessionId for this type of message.
    void
    Write the current message to the output stream as a full message following the specification from the I2CP definition.
  • Method Details

    • readMessage

      void readMessage(InputStream in, int size, int type) throws I2CPMessageException, IOException
      Read the contents from the input stream into the current class's format. The stream should be the message body as defined by the client access layer specification after the message header (4 bytes specifying the size of the message, 1 byte specifying the type of the message).
      Parameters:
      in - stream to read from
      size - number of bytes in the message payload
      type - type of message (should equal getType())
      Throws:
      I2CPMessageException - if the stream doesn't contain a valid message that this class can read.
      IOException - if there is a problem reading from the stream
    • readMessage

      void readMessage(InputStream in) throws I2CPMessageException, IOException
      Read the contents from the input stream into the current class's format. The stream should be the message header and body as defined by the I2CP specification
      Parameters:
      in - stream to read from
      Throws:
      I2CPMessageException - if the stream doesn't contain a valid message that this class can read.
      IOException - if there is a problem reading from the stream
    • writeMessage

      void writeMessage(OutputStream out) throws I2CPMessageException, IOException
      Write the current message to the output stream as a full message following the specification from the I2CP definition.
      Parameters:
      out - OutputStream
      Throws:
      I2CPMessageException - if the current object doesn't have sufficient data to write a properly formatted message.
      IOException - if there is a problem writing to the stream
    • getType

      int getType()
      Return the unique identifier for this type of message, as specified in the network specification document under #ClientAccessLayerMessages
      Returns:
      unique identifier for this type of message
    • sessionId

      SessionId sessionId()
      Return the SessionId for this type of message. Most but not all message types include a SessionId. The ones that do already define getSessionId(), but some return a SessionId and some return a long, so we define a new method here.
      Returns:
      SessionId or null if this message type does not include a SessionId
      Since:
      0.9.21