Package net.i2p.router
Class OutNetMessage
java.lang.Object
net.i2p.router.OutNetMessage
public class OutNetMessage extends Object implements CDPQEntry
Wrap up an outbound I2NP message, along with the information associated with its
delivery and jobs to be fired off if particular events occur.
-
Field Summary
Fields Modifier and Type Field Description static intPRIORITY_BUILD_REPLYstatic intPRIORITY_EXPLORATORYstatic intPRIORITY_HIGHESTPriorities, higher is higher priority.static intPRIORITY_HIS_BUILD_REQUESTstatic intPRIORITY_HIS_NETDB_STOREstatic intPRIORITY_LOWESTstatic intPRIORITY_MY_BUILD_REQUESTstatic intPRIORITY_MY_DATAmay be adjusted +/- 25 for outbound trafficstatic intPRIORITY_MY_NETDB_LOOKUPstatic intPRIORITY_MY_NETDB_STOREstatic intPRIORITY_MY_NETDB_STORE_LOWstatic intPRIORITY_NETDB_EXPLOREstatic intPRIORITY_NETDB_FLOODstatic intPRIORITY_NETDB_HARVESTstatic intPRIORITY_NETDB_REPLYstatic intPRIORITY_PARTICIPATING -
Constructor Summary
Constructors Constructor Description OutNetMessage(RouterContext context)Null msg and target, zero expiration (used in OutboundMessageRegistry only)OutNetMessage(RouterContext context, I2NPMessage msg, long expiration, int priority, RouterInfo target)Standard constructor -
Method Summary
Modifier and Type Method Description voidbeginSend()voiddiscardData()We've done what we need to do with the data from this message, though we may keep the object around for a while to use its ID, jobs, etc.voiddrop()For CDQlonggetCreated()ExceptiongetCreatedBy()Deprecated.longgetEnqueueTime()For CDQlonggetExpiration()Specify the # ms since the epoch after which if the message has not been sent the OnFailedSend job should be fired and the message should be removed from the pool.Set<String>getFailedTransports()longgetLifetime()time since the message was createdI2NPMessagegetMessage()Specifies the message to be sent.intgetMessageData(byte[] outBuffer)Copies the message data to outbuffer.longgetMessageId()intgetMessageSize()How large the message is, including the full 16 byte header.StringgetMessageType()For debugging only.intgetMessageTypeId()JobgetOnFailedReplyJob()If the Message selector is specified but it doesn't find a reply before its expiration passes, this job is enqueued.JobgetOnFailedSendJob()If the router could not be reached or the expiration passed, this job is enqueued.ReplyJobgetOnReplyJob()If the MessageSelector detects a reply, this job is enqueuedJobgetOnSendJob()After the message is successfully passed to the router specified, the given job is enqueued.intgetPriority()Specify the priority of the message, where higher numbers are higher priority.MessageSelectorgetReplySelector()Defines a MessageSelector to find a reply to this message.longgetSendBegin()when did the sending process beginlonggetSendTime()time the transport tries to send the message (including any queueing)longgetSeqNum()For CDPQRouterInfogetTarget()Specifies the router to which the message should be delivered.LonggetTimestamp(String eventName)Deprecated.unusedMap<String,Long>getTimestamps()Deprecated.unusedvoidsetEnqueueTime(long now)For CDQvoidsetOnFailedReplyJob(Job job)voidsetOnFailedSendJob(Job job)voidsetOnReplyJob(ReplyJob job)voidsetOnSendJob(Job job)voidsetReplySelector(MessageSelector selector)voidsetSeqNum(long num)For CDPQvoidtimestamp(String eventName)Stamp the message's progress.StringtoString()voidtransportFailed(String transportStyle)
-
Field Details
-
PRIORITY_HIGHEST
public static final int PRIORITY_HIGHESTPriorities, higher is higher priority.- Since:
- 0.9.3
- See Also:
- Constant Field Values
-
PRIORITY_MY_BUILD_REQUEST
public static final int PRIORITY_MY_BUILD_REQUEST- See Also:
- Constant Field Values
-
PRIORITY_MY_NETDB_LOOKUP
public static final int PRIORITY_MY_NETDB_LOOKUP- See Also:
- Constant Field Values
-
PRIORITY_MY_NETDB_STORE
public static final int PRIORITY_MY_NETDB_STORE- See Also:
- Constant Field Values
-
PRIORITY_EXPLORATORY
public static final int PRIORITY_EXPLORATORY- See Also:
- Constant Field Values
-
PRIORITY_MY_DATA
public static final int PRIORITY_MY_DATAmay be adjusted +/- 25 for outbound traffic- See Also:
- Constant Field Values
-
PRIORITY_HIS_BUILD_REQUEST
public static final int PRIORITY_HIS_BUILD_REQUEST- See Also:
- Constant Field Values
-
PRIORITY_BUILD_REPLY
public static final int PRIORITY_BUILD_REPLY- See Also:
- Constant Field Values
-
PRIORITY_NETDB_REPLY
public static final int PRIORITY_NETDB_REPLY- See Also:
- Constant Field Values
-
PRIORITY_HIS_NETDB_STORE
public static final int PRIORITY_HIS_NETDB_STORE- See Also:
- Constant Field Values
-
PRIORITY_NETDB_FLOOD
public static final int PRIORITY_NETDB_FLOOD- See Also:
- Constant Field Values
-
PRIORITY_PARTICIPATING
public static final int PRIORITY_PARTICIPATING- See Also:
- Constant Field Values
-
PRIORITY_MY_NETDB_STORE_LOW
public static final int PRIORITY_MY_NETDB_STORE_LOW- See Also:
- Constant Field Values
-
PRIORITY_NETDB_EXPLORE
public static final int PRIORITY_NETDB_EXPLORE- See Also:
- Constant Field Values
-
PRIORITY_NETDB_HARVEST
public static final int PRIORITY_NETDB_HARVEST- See Also:
- Constant Field Values
-
PRIORITY_LOWEST
public static final int PRIORITY_LOWEST- See Also:
- Constant Field Values
-
-
Constructor Details
-
OutNetMessage
Null msg and target, zero expiration (used in OutboundMessageRegistry only)- Since:
- 0.9.9
-
OutNetMessage
public OutNetMessage(RouterContext context, I2NPMessage msg, long expiration, int priority, RouterInfo target)Standard constructor- Parameters:
msg- generally non-nulltarget- generally non-null- Since:
- 0.9.9
-
-
Method Details
-
timestamp
Stamp the message's progress. Only useful if log level is INFO or DEBUG- Parameters:
eventName- what occurred
-
getTimestamps
Deprecated.unused -
getTimestamp
Deprecated.unused -
getCreatedBy
Deprecated.- Returns:
- null always
-
getTarget
Specifies the router to which the message should be delivered. Generally non-null but may be null in special cases. -
getMessage
Specifies the message to be sent. Generally non-null but may be null in special cases. -
getMessageType
For debugging only.- Returns:
- the simple class name
-
getMessageTypeId
public int getMessageTypeId() -
getMessageId
public long getMessageId() -
getMessageSize
public int getMessageSize()How large the message is, including the full 16 byte header. Transports with different header sizes should adjust. -
getMessageData
public int getMessageData(byte[] outBuffer)Copies the message data to outbuffer. Used only by VM Comm System.- Returns:
- the length, or -1 if message is null
-
getPriority
public int getPriority()Specify the priority of the message, where higher numbers are higher priority. Higher priority messages should be delivered before lower priority ones, though some algorithm may be used to avoid starvation.- Specified by:
getPriorityin interfacePQEntry
-
getExpiration
public long getExpiration()Specify the # ms since the epoch after which if the message has not been sent the OnFailedSend job should be fired and the message should be removed from the pool. If the message has already been sent, this expiration is ignored and the expiration from the ReplySelector is used. -
getOnSendJob
After the message is successfully passed to the router specified, the given job is enqueued. -
setOnSendJob
-
getOnFailedSendJob
If the router could not be reached or the expiration passed, this job is enqueued. -
setOnFailedSendJob
-
getOnReplyJob
If the MessageSelector detects a reply, this job is enqueued -
setOnReplyJob
-
getOnFailedReplyJob
If the Message selector is specified but it doesn't find a reply before its expiration passes, this job is enqueued. -
setOnFailedReplyJob
-
getReplySelector
Defines a MessageSelector to find a reply to this message. -
setReplySelector
-
transportFailed
-
getFailedTransports
-
getSendBegin
public long getSendBegin()when did the sending process begin -
beginSend
public void beginSend() -
getCreated
public long getCreated() -
getLifetime
public long getLifetime()time since the message was created -
getSendTime
public long getSendTime()time the transport tries to send the message (including any queueing) -
setEnqueueTime
public void setEnqueueTime(long now)For CDQ- Specified by:
setEnqueueTimein interfaceCDQEntry- Since:
- 0.9.3
-
getEnqueueTime
public long getEnqueueTime()For CDQ- Specified by:
getEnqueueTimein interfaceCDQEntry- Since:
- 0.9.3
-
drop
public void drop()For CDQ -
setSeqNum
public void setSeqNum(long num)For CDPQ -
getSeqNum
public long getSeqNum()For CDPQ -
discardData
public void discardData()We've done what we need to do with the data from this message, though we may keep the object around for a while to use its ID, jobs, etc. -
toString
-