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

public class ReportAbuseMessageextends I2CPMessageImpl
Defines the message a client sends to a router when asking the router what its address visibility is.
  • Field Details

    • MESSAGE_TYPE

      public static final int MESSAGE_TYPE
      I2CP message type number identifying an abuse report.
      See Also:
    • _sessionId

      private SessionId _sessionId
      The session the report is about.
    • _severity

      private AbuseSeverity _severity
      How serious the abuse was.
    • _reason

      private AbuseReason _reason
      What the client objects to.
    • _messageId

      private MessageId _messageId
      The message the abuse was seen on.
  • Constructor Details

    • ReportAbuseMessage

      public ReportAbuseMessage()
      Creates an empty report, for I2CP deserialization.
  • Method Details

    • getSessionId

      public SessionId getSessionId()
      Session making the report.
      Returns:
      the session id, null until set or read
    • 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 this abuse report was sent from
    • getSeverity

      public AbuseSeverity getSeverity()
      Reports how serious the abuse was judged to be.
      Returns:
      the reported severity level
    • setSeverity

      public void setSeverity(AbuseSeverity severity)
      Severity of the abuse.
      Parameters:
      severity - how serious the reported behaviour is judged to be
    • getReason

      public AbuseReason getReason()
      Reports which category of misbehaviour was observed.
      Returns:
      the free-text category string
    • setReason

      public void setReason(AbuseReason reason)
      Reason for the abuse.
      Parameters:
      reason - the category of misbehaviour being reported
    • getMessageId

      public MessageId getMessageId()
      Message the abuse was seen on.
      Returns:
      the message id, null until set or read
    • setMessageId

      public void setMessageId(MessageId id)
      Message ID of the reported message.
      Parameters:
      id - the identifier of the message being complained about
    • 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:
      MESSAGE_TYPE, 29
    • toString

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