net.i2p.client

## Class I2CPMessageProducer

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

     class I2CPMessageProducer
    extends Object

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

Author:
  jrandom

### Field Summary

Fields
`(package private) static boolean` `END_TO_END_CRYPTO` Should we include the I2CP end to end crypto (which is in addition to any garlic crypto added by the router)

### Constructor Summary

Constructors
Constructor and Description
`I2CPMessageProducer(I2PAppContext context)`

### Method Summary

Methods
`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, PrivateKey priv)` Create a new signed leaseSet in response to a request to do so and send it to the router
`void` `disconnect(I2PSessionImpl session)` Send messages to the router destroying the session and disconnecting
`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, SessionTag tag, SessionKey key, Set 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`

### Field Detail

#### END_TO_END_CRYPTO

    static final boolean END_TO_END_CRYPTO

Should we include the I2CP end to end crypto (which is in addition to any garlic crypto added by the router)

See Also:
  Constant Field Values

### Constructor Detail

#### I2CPMessageProducer

    public I2CPMessageProducer(I2PAppContext context)

### Method Detail

#### updateBandwidth

    public void updateBandwidth(I2PSessionImpl session)

Update the bandwidth setting

Since:
  0.8.4

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

#### disconnect

    public void disconnect(I2PSessionImpl session)
                    throws I2PSessionException

Send messages to the router destroying the session and disconnecting

Throws:
  `I2PSessionException`

#### sendMessage

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

Package up and send the payload to the router for delivery

Parameters:
  `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`

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

Throws:
  `I2PSessionException`
Since:
  0.8.4

#### reportAbuse

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

Send an abuse message to the router

Throws:
  `I2PSessionException`

#### createLeaseSet

    public void createLeaseSet(I2PSessionImpl session,
                      LeaseSet leaseSet,
                      SigningPrivateKey signingPriv,
                      PrivateKey priv)
                        throws I2PSessionException

Create a new signed leaseSet in response to a request to do so and send it to the router

Throws:
  `I2PSessionException`

#### updateTunnels

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

Update number of tunnels

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