net.i2p.router

## Class ClientMessage

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

-     public class ClientMessage
      extends Object

  Wrap a message either destined for a local client or received from one. Note that an outbound message may get routed as an inbound message for local-local communication.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientMessage(Destination toDest, Payload payload, SessionConfig config, Destination fromDest, MessageId msgID, long messageNonce, long expiration, int flags)` For outbound (locally originated)
    `ClientMessage(Hash toDestHash, Payload payload)` For inbound (from remote dest)

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Destination` | `getDestination()` Retrieve the destination to which this message is directed.
    `Hash` | `getDestinationHash()` Retrieve the destination to which this message is directed.
    `long` | `getExpiration()` Expiration requested by the client that sent the message.
    `int` | `getFlags()` Flags requested by the client that sent the message.
    `Destination` | `getFromDestination()` Valid for outbound; null for inbound.
    `MessageId` | `getMessageId()` Valid for outbound; null for inbound.
    `long` | `getMessageNonce()` Valid for outbound; 0 for inbound.
    `Payload` | `getPayload()` Retrieve the payload of the message.
    `SessionConfig` | `getSenderConfig()` Retrieve the session config of the client that sent the message.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientMessage

          public ClientMessage(Destination toDest,
                               Payload payload,
                               SessionConfig config,
                               Destination fromDest,
                               MessageId msgID,
                               long messageNonce,
                               long expiration,
                               int flags)

      For outbound (locally originated)
      Parameters:
        `msgID` - the router's ID for this message
        `messageNonce` - the client's ID for this message

    - #### ClientMessage

          public ClientMessage(Hash toDestHash,
                               Payload payload)

      For inbound (from remote dest)

  - ### Method Detail

    - #### getDestination

          public Destination getDestination()

      Retrieve the destination to which this message is directed. Valid for outbound; null for inbound. If null, use getDestinationHash()

    - #### getDestinationHash

          public Hash getDestinationHash()

      Retrieve the destination to which this message is directed. Valid for inbound; null for outbound. If null, use getDestination()

    - #### getExpiration

          public long getExpiration()

      Expiration requested by the client that sent the message. This will only be available for locally originated messages.

    - #### getFlags

          public int getFlags()

      Flags requested by the client that sent the message. This will only be available for locally originated messages.

    - #### getFromDestination

          public Destination getFromDestination()

      Valid for outbound; null for inbound.

    - #### getMessageId

          public MessageId getMessageId()

      Valid for outbound; null for inbound.

    - #### getMessageNonce

          public long getMessageNonce()

      Valid for outbound; 0 for inbound.

    - #### getPayload

          public Payload getPayload()

      Retrieve the payload of the message. All ClientMessage objects should have a payload

    - #### getSenderConfig

          public SessionConfig getSenderConfig()

      Retrieve the session config of the client that sent the message. This will only be available if the client was local