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

public class SessionStatusMessageextends I2CPMessageImpl
Defines the message a router sends to a client indicating the status of the session.
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      I2CP message type of a session status report.
      See Also:
    • STATUS_DESTROYED

      public static final int STATUS_DESTROYED
      Status code reporting that the session was destroyed.
      See Also:
    • STATUS_CREATED

      public static final int STATUS_CREATED
      Status code reporting that the session was created.
      See Also:
    • STATUS_UPDATED

      public static final int STATUS_UPDATED
      Status code reporting that the session was updated.
      See Also:
    • STATUS_INVALID

      public static final int STATUS_INVALID
      Status code reporting that the session is invalid.
      See Also:
    • STATUS_REFUSED

      public static final int STATUS_REFUSED
      Session refused status.
      See Also:
    • STATUS_DUP_DEST

      public static final int STATUS_DUP_DEST
      Used internally, not in spec, will be remapped to STATUS_INVALID before being sent.
      See Also:
  • Constructor Details

    • SessionStatusMessage

      public SessionStatusMessage()
      Creates a message reporting the invalid status.
  • Method Details

    • getSessionId

      public SessionId getSessionId()
      Session id.
      Returns:
      the session id
    • sessionId

      public SessionId sessionId()
      Return the SessionId for this message.
      Specified by:
      sessionId in interface I2CPMessage
      Overrides:
      sessionId in class I2CPMessageImpl
      Returns:
      null always. Extending classes with a SessionId must override.
    • setSessionId

      public void setSessionId(SessionId id)
      Session ID for this message.
      Parameters:
      id - the session whose status this message reports
    • getStatus

      public int getStatus()
      Returns the reported session status.
      Returns:
      one of the STATUS_* constants describing the session's state
    • setStatus

      public final void setStatus(int status)
      Status of the session.
      Parameters:
      status - one of the STATUS_* constants describing the session's current state
    • 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()
      Returns the I2CP message type of this message.
      Returns:
      SessionStatusMessage's I2CP type number, for dispatch
    • toString

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