net.i2p.client.impl

## Class I2CPMessageProducer

- java.lang.Object
- - net.i2p.client.impl.I2CPMessageProducer

-     class I2CPMessageProducer
      extends Object

  Produce the various messages the session needs to send to the router.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2CPMessageProducer(I2PAppContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `connect(I2PSessionImpl session)` Send all the messages that a client needs to send to a router to establish a new session.
    `void` | `createLeaseSet(I2PSessionImpl session, LeaseSet leaseSet, SigningPrivateKey signingPriv, List<PrivateKey> privs)` In response to a RequestLeaseSet Message from the router, send a CreateLeaseset Message back to the router.
    `void` | `disconnect(I2PSessionImpl session)` Send a message to the router destroying the session, which could be a subsession.
    `void` | `reportAbuse(I2PSessionImpl session, int msgId, int severity)` Send an abuse message to the router
    `void` | `sendMessage(I2PSessionImpl session, Destination dest, long nonce, byte[] payload, long expires, int flags)` Package up and send the payload to the router for delivery
    `void` | `sendMessage(I2PSessionImpl session, Destination dest, long nonce, byte[] payload, SendMessageOptions options)` Package up and send the payload to the router for delivery
    `void` | `sendMessage(I2PSessionImpl session, Destination dest, long nonce, byte[] payload, SessionTag tag, SessionKey key, Set<SessionTag> tags, SessionKey newKey, long expires)` Package up and send the payload to the router for delivery
    `void` | `updateBandwidth(I2PSessionImpl session)` Update the bandwidth setting
    `void` | `updateTunnels(I2PSessionImpl session, int tunnels)` Update number of tunnels

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

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

- - ### Constructor Detail

    - #### I2CPMessageProducer

          public I2CPMessageProducer(I2PAppContext context)

  - ### Method Detail

    - #### connect

          public void connect(I2PSessionImpl session)
                       throws I2PSessionException

      Send all the messages that a client needs to send to a router to establish a new session.
      Throws:
        `I2PSessionException`

    - #### createLeaseSet

          public void createLeaseSet(I2PSessionImpl session,
                                     LeaseSet leaseSet,
                                     SigningPrivateKey signingPriv,
                                     List<PrivateKey> privs)
                              throws I2PSessionException

      In response to a RequestLeaseSet Message from the router, send a CreateLeaseset Message back to the router. This method is misnamed, it does not create the LeaseSet, the caller does that.
      Parameters:
        `signingPriv` - ignored for LS2
      Throws:
        `I2PSessionException`

    - #### disconnect

          public void disconnect(I2PSessionImpl session)
                          throws I2PSessionException

      Send a message to the router destroying the session, which could be a subsession. This does NOT close the socket.
      Throws:
        `I2PSessionException`

    - #### reportAbuse

          public void reportAbuse(I2PSessionImpl session,
                                  int msgId,
                                  int severity)
                           throws I2PSessionException

      Send an abuse message to the router
      Throws:
        `I2PSessionException`

    - #### sendMessage

          public void sendMessage(I2PSessionImpl session,
                                  Destination dest,
                                  long nonce,
                                  byte[] payload,
                                  long expires,
                                  int flags)
                           throws I2PSessionException

      Package up and send the payload to the router for delivery
      Parameters:
        `nonce` - 0 to 0xffffffff; if 0, the router will not reply with a MessageStatusMessage
      Throws:
        `I2PSessionException`

    - #### sendMessage

          public void sendMessage(I2PSessionImpl session,
                                  Destination dest,
                                  long nonce,
                                  byte[] payload,
                                  SendMessageOptions options)
                           throws I2PSessionException

      Package up and send the payload to the router for delivery
      Parameters:
        `nonce` - 0 to 0xffffffff; if 0, the router will not reply with a MessageStatusMessage
      Throws:
        `I2PSessionException`

    - #### sendMessage

          public void sendMessage(I2PSessionImpl session,
                                  Destination dest,
                                  long nonce,
                                  byte[] payload,
                                  SessionTag tag,
                                  SessionKey key,
                                  Set<SessionTag> tags,
                                  SessionKey newKey,
                                  long expires)
                           throws I2PSessionException

      Package up and send the payload to the router for delivery
      Parameters:
        `nonce` - 0 to 0xffffffff; if 0, the router will not reply with a MessageStatusMessage
        `tag` - unused - no end-to-end crypto
        `tags` - unused - no end-to-end crypto
        `key` - unused - no end-to-end crypto
        `newKey` - unused - no end-to-end crypto
      Throws:
        `I2PSessionException`

    - #### updateBandwidth

          public void updateBandwidth(I2PSessionImpl session)

      Update the bandwidth setting

    - #### updateTunnels

          public void updateTunnels(I2PSessionImpl session,
                                    int tunnels)
                             throws I2PSessionException

      Update number of tunnels
      Parameters:
        `tunnels` - 0 for original configured number
      Throws:
        `I2PSessionException`