java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.CreateSessionMessage
All Implemented Interfaces:
I2CPMessage

public class CreateSessionMessageextends I2CPMessageImpl
Defines the message a client sends to a router when establishing a new session.
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      I2CP message type number identifying a session creation request.
      See Also:
    • _sessionConfig

      private SessionConfig _sessionConfig
      The options the client asked the session to use.
  • Constructor Details

    • CreateSessionMessage

      public CreateSessionMessage(SessionConfig config)
      Carries the given session configuration to the router.
      Parameters:
      config - the session properties to send to the router in this message
    • CreateSessionMessage

      public CreateSessionMessage()
      Creates a message with an empty session configuration.
  • Method Details

    • getSessionConfig

      public SessionConfig getSessionConfig()
      Configuration requested for the new session.
      Returns:
      never null, the no-arg constructor creates an empty config
    • setSessionConfig

      public void setSessionConfig(SessionConfig config)
      Session config for this message.
      Parameters:
      config - the session properties replacing the current ones
    • doReadMessage

      protected void doReadMessage(InputStream in, int size) throws I2CPMessageException, IOException
      Read the message body from the input stream.
      Specified by:
      doReadMessage in class I2CPMessageImpl
      Parameters:
      in - positioned just past the 4 byte size and 1 byte type header
      size - how many payload bytes remain to be read
      Throws:
      I2CPMessageException - if the message format is invalid
      IOException - if there's an error reading from the stream
    • doWriteMessage

      protected byte[] doWriteMessage() throws I2CPMessageException, IOException
      Write the message body to the output stream.
      Specified by:
      doWriteMessage in class I2CPMessageImpl
      Returns:
      byte array
      Throws:
      I2CPMessageException - if the message cannot be written
      IOException - if there's an error writing to the stream
    • getType

      public int getType()
      Reports this message's I2CP type number.
      Returns:
      the I2CP type number of this message
    • toString

      public String toString()
      Returns a string representation of this message.
      Overrides:
      toString in class Object