net.i2p.router

## Class OutNetMessage

- java.lang.Object
- - net.i2p.router.OutNetMessage

-     public class OutNetMessage
      extends Object

  Wrap up an outbound I2NP message, along with the information associated with its delivery and jobs to be fired off if particular events occur.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OutNetMessage(RouterContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginPrepare()`
    `void` | `beginSend()`
    `void` | `beginTransmission()`
    `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.
    `boolean` | `equals(Object obj)`
    `long` | `getCreated()`
    `Exception` | `getCreatedBy()`
    `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.
    `Set` | `getFailedTransports()` not thread safe - dont fail transports and iterate over this at the same time
    `long` | `getLifetime()` time since the message was created
    `I2NPMessage` | `getMessage()` Specifies the message to be sent
    `int` | `getMessageData(byte[] outBuffer)`
    `long` | `getMessageId()`
    `long` | `getMessageSize()`
    `String` | `getMessageType()`
    `int` | `getMessageTypeId()`
    `Job` | `getOnFailedReplyJob()` If the Message selector is specified but it doesn't find a reply before its expiration passes, this job is enqueued.
    `Job` | `getOnFailedSendJob()` If the router could not be reached or the expiration passed, this job is enqueued.
    `ReplyJob` | `getOnReplyJob()` If the MessageSelector detects a reply, this job is enqueued
    `Job` | `getOnSendJob()` After the message is successfully passed to the router specified, the given job is enqueued.
    `long` | `getPreparationTime()` how long it took to prepare the i2np message for transmission (including serialization and transport layer encryption)
    `int` | `getPriority()` Specify the priority of the message, where higher numbers are higher priority.
    `int` | `getQueueSize()` number of messages ahead of this one going to the targetted peer when it is first enqueued
    `MessageSelector` | `getReplySelector()` Defines a MessageSelector to find a reply to this message.
    `long` | `getSendBegin()` when did the sending process begin
    `long` | `getSendTime()` time the transport tries to send the message (including any queueing)
    `RouterInfo` | `getTarget()` Specifies the router to which the message should be delivered.
    `Long` | `getTimestamp(String eventName)` Deprecated. unused
    `Map<String,Long>` | `getTimestamps()` Deprecated. unused
    `long` | `getTransmissionTime()` time during which the i2np message is actually in flight
    `int` | `hashCode()`
    `void` | `prepared()`
    `void` | `prepared(Object buf)`
    `Object` | `releasePreparationBuffer()`
    `void` | `setExpiration(long expiration)`
    `void` | `setMessage(I2NPMessage msg)`
    `void` | `setOnFailedReplyJob(Job job)`
    `void` | `setOnFailedSendJob(Job job)`
    `void` | `setOnReplyJob(ReplyJob job)`
    `void` | `setOnSendJob(Job job)`
    `void` | `setPriority(int priority)`
    `void` | `setQueueSize(int size)`
    `void` | `setReplySelector(MessageSelector selector)`
    `void` | `setTarget(RouterInfo target)`
    `long` | `timestamp(String eventName)` Stamp the message's progress
    `String` | `toString()`
    `void` | `transportFailed(String transportStyle)`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### OutNetMessage

          public OutNetMessage(RouterContext context)

  - ### Method Detail

    - #### timestamp

          public long timestamp(String eventName)

      Stamp the message's progress
      Parameters:
        `eventName` - what occurred
      Returns:
        how long this message has been 'in flight'

    - #### getTimestamps

          public Map<String,Long> getTimestamps()

      Deprecated. unused

    - #### getTimestamp

          public Long getTimestamp(String eventName)

      Deprecated. unused

    - #### getCreatedBy

          public Exception getCreatedBy()

    - #### getTarget

          public RouterInfo getTarget()

      Specifies the router to which the message should be delivered.

    - #### setTarget

          public void setTarget(RouterInfo target)

    - #### getMessage

          public I2NPMessage getMessage()

      Specifies the message to be sent

    - #### setMessage

          public void setMessage(I2NPMessage msg)

    - #### getMessageType

          public String getMessageType()

    - #### getMessageTypeId

          public int getMessageTypeId()

    - #### getMessageId

          public long getMessageId()

    - #### getMessageSize

          public long getMessageSize()

    - #### getMessageData

          public int getMessageData(byte[] outBuffer)

    - #### 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.

    - #### setPriority

          public void setPriority(int priority)

    - #### 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.

    - #### setExpiration

          public void setExpiration(long expiration)

    - #### getOnSendJob

          public Job getOnSendJob()

      After the message is successfully passed to the router specified, the given job is enqueued.

    - #### setOnSendJob

          public void setOnSendJob(Job job)

    - #### getOnFailedSendJob

          public Job getOnFailedSendJob()

      If the router could not be reached or the expiration passed, this job is enqueued.

    - #### setOnFailedSendJob

          public void setOnFailedSendJob(Job job)

    - #### getOnReplyJob

          public ReplyJob getOnReplyJob()

      If the MessageSelector detects a reply, this job is enqueued

    - #### setOnReplyJob

          public void setOnReplyJob(ReplyJob job)

    - #### getOnFailedReplyJob

          public Job getOnFailedReplyJob()

      If the Message selector is specified but it doesn't find a reply before its expiration passes, this job is enqueued.

    - #### setOnFailedReplyJob

          public void setOnFailedReplyJob(Job job)

    - #### getReplySelector

          public MessageSelector getReplySelector()

      Defines a MessageSelector to find a reply to this message.

    - #### setReplySelector

          public void setReplySelector(MessageSelector selector)

    - #### transportFailed

          public void transportFailed(String transportStyle)

    - #### getFailedTransports

          public Set getFailedTransports()

      not thread safe - dont fail transports and iterate over this at the same time

    - #### getSendBegin

          public long getSendBegin()

      when did the sending process begin

    - #### beginSend

          public void beginSend()

    - #### beginTransmission

          public void beginTransmission()

    - #### beginPrepare

          public void beginPrepare()

    - #### prepared

          public void prepared()

    - #### prepared

          public void prepared(Object buf)

    - #### releasePreparationBuffer

          public Object releasePreparationBuffer()

    - #### 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)

    - #### getTransmissionTime

          public long getTransmissionTime()

      time during which the i2np message is actually in flight

    - #### getPreparationTime

          public long getPreparationTime()

      how long it took to prepare the i2np message for transmission (including serialization and transport layer encryption)

    - #### getQueueSize

          public int getQueueSize()

      number of messages ahead of this one going to the targetted peer when it is first enqueued

    - #### setQueueSize

          public void setQueueSize(int size)

    - #### 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

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`