java.lang.Object
net.i2p.data.i2cp.I2CPMessageImpl
net.i2p.data.i2cp.ReportAbuseMessage
- All Implemented Interfaces:
I2CPMessage
Defines the message a client sends to a router when asking the router what its address visibility is.
Field Summary
Modifier and TypeFieldDescriptionprivate MessageIdThe message the abuse was seen on.private AbuseReasonWhat the client objects to.private SessionIdThe session the report is about.private AbuseSeverityHow serious the abuse was.static final intI2CP message type number identifying an abuse report.Constructor Summary
ConstructorsMethod Summary
Public MethodsModifier and TypeMethodDescriptionprotected voiddoReadMessage(InputStream in, int size) Read the message body from the input stream.protected byte[]Write the message body to the output stream.Message the abuse was seen on.Reports which category of misbehaviour was observed.Session making the report.Reports how serious the abuse was judged to be.intgetType()Reports this message's I2CP type number.Return the SessionId for this message.voidMessage ID of the reported message.voidsetReason(AbuseReason reason) Reason for the abuse.voidSession ID for this message.voidsetSeverity(AbuseSeverity severity) Severity of the abuse.toString()Returns a string representation of this message.Methods inherited from class I2CPMessageImpl
readBytes, readMessage, readMessage, writeBytes, writeMessageModifier and TypeMethodDescriptionvoidreadBytes(InputStream in) Read the message from the stream, wrapping I2CPMessageException inDataFormatException.voidValidate the type and size of the message, and then read the message into the data structures.voidreadMessage(InputStream in, int length, int type) Read the body into the data structures.voidwriteBytes(OutputStream out) Write the message to the stream, wrapping I2CPMessageException in DataFormatException.voidwriteMessage(OutputStream out) Write out the full message to the stream, including the 4 byte size and 1 byte type header.
Field Details
MESSAGE_TYPE
public static final int MESSAGE_TYPEI2CP message type number identifying an abuse report.- See Also:
_sessionId
The session the report is about._severity
How serious the abuse was._reason
What the client objects to._messageId
The message the abuse was seen on.
Constructor Details
ReportAbuseMessage
public ReportAbuseMessage()Creates an empty report, for I2CP deserialization.
Method Details
getSessionId
Session making the report.- Returns:
- the session id, null until set or read
sessionId
Return the SessionId for this message.- Specified by:
sessionIdin interfaceI2CPMessage- Overrides:
sessionIdin classI2CPMessageImpl- Returns:
- null always. Extending classes with a SessionId must override.
setSessionId
Session ID for this message.- Parameters:
id- the session this abuse report was sent from
getSeverity
Reports how serious the abuse was judged to be.- Returns:
- the reported severity level
setSeverity
Severity of the abuse.- Parameters:
severity- how serious the reported behaviour is judged to be
getReason
Reports which category of misbehaviour was observed.- Returns:
- the free-text category string
setReason
Reason for the abuse.- Parameters:
reason- the category of misbehaviour being reported
getMessageId
Message the abuse was seen on.- Returns:
- the message id, null until set or read
setMessageId
Message ID of the reported message.- Parameters:
id- the identifier of the message being complained about
doReadMessage
Read the message body from the input stream.- Specified by:
doReadMessagein classI2CPMessageImpl- Parameters:
in- positioned just past the 4 byte size and 1 byte type headersize- how many payload bytes remain to be read- Throws:
I2CPMessageException- if the message format is invalidIOException- if there's an error reading from the stream
doWriteMessage
Write the message body to the output stream.- Specified by:
doWriteMessagein classI2CPMessageImpl- Returns:
- byte array
- Throws:
I2CPMessageException- if the message cannot be writtenIOException- if there's an error writing to the stream
getType
toString