net.i2p.router.message

## Class GarlicConfig

- java.lang.Object
- - net.i2p.router.message.GarlicConfig

- Direct Known Subclasses:
    PayloadGarlicConfig

      class GarlicConfig
      extends Object

  Define the contents of a garlic chunk that contains 1 or more sub garlics. This is the top-level config for a Garlic Message that contains cloves. For cloves themselves, see PayloadGarlicConfig. Note that this is somewhat misnamed as it contains the actual cloves, not just the config.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `GarlicConfig(Certificate cert, long id, long expiration, DeliveryInstructions di)`
    `protected` | `GarlicConfig(List<GarlicConfig> cloveConfigs, Certificate cert, long id, long expiration, DeliveryInstructions di)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addClove(GarlicConfig config)` Add a clove to the current message - if any cloves are added, an I2NP message cannot be specified via setPayload.
    `void` | `clearCloves()`
    `Certificate` | `getCertificate()` Certificate for the getRecipient() to pay for their processing
    `GarlicConfig` | `getClove(int index)`
    `int` | `getCloveCount()`
    `DeliveryInstructions` | `getDeliveryInstructions()` Specify how the I2NPMessage in the clove should be handled.
    `long` | `getExpiration()` Expiration of the clove, after which it should be dropped
    `long` | `getId()` Unique ID of the clove
    `RouterInfo` | `getRecipient()`
    `PublicKey` | `getRecipientPublicKey()`
    `protected String` | `getSubData()`
    `void` | `setRecipient(RouterInfo info)` Router to receive and process this clove - the router that will open the delivery instructions and decide what to do process it locally as an I2NPMessage, forward it as an I2NPMessage to a router, forward it as an I2NPMessage to a Destination, or forward it as an I2NPMessage to a tunnel.
    `void` | `setRecipientPublicKey(PublicKey recipientPublicKey)` Public key of the router to receive and process this clove.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### GarlicConfig

          public GarlicConfig(Certificate cert,
                              long id,
                              long expiration,
                              DeliveryInstructions di)

    - #### GarlicConfig

          protected GarlicConfig(List<GarlicConfig> cloveConfigs,
                                 Certificate cert,
                                 long id,
                                 long expiration,
                                 DeliveryInstructions di)

  - ### Method Detail

    - #### addClove

          public void addClove(GarlicConfig config)

      Add a clove to the current message - if any cloves are added, an I2NP message cannot be specified via setPayload. This means that the resulting GarlicClove represented by this GarlicConfig must be a GarlicMessage itself

    - #### clearCloves

          public void clearCloves()

    - #### getCertificate

          public Certificate getCertificate()

      Certificate for the getRecipient() to pay for their processing

    - #### getClove

          public GarlicConfig getClove(int index)

    - #### getCloveCount

          public int getCloveCount()

    - #### getDeliveryInstructions

          public DeliveryInstructions getDeliveryInstructions()

      Specify how the I2NPMessage in the clove should be handled.

    - #### getExpiration

          public long getExpiration()

      Expiration of the clove, after which it should be dropped

    - #### getId

          public long getId()

      Unique ID of the clove

    - #### getRecipient

          public RouterInfo getRecipient()

    - #### getRecipientPublicKey

          public PublicKey getRecipientPublicKey()

    - #### getSubData

          protected String getSubData()

    - #### setRecipient

          public void setRecipient(RouterInfo info)

      Router to receive and process this clove - the router that will open the delivery instructions and decide what to do process it locally as an I2NPMessage, forward it as an I2NPMessage to a router, forward it as an I2NPMessage to a Destination, or forward it as an I2NPMessage to a tunnel. Used only if recipient public key is not set.

    - #### setRecipientPublicKey

          public void setRecipientPublicKey(PublicKey recipientPublicKey)

      Public key of the router to receive and process this clove. This is useful for garlic routed messages encrypted to the router at the end of a tunnel, as their RouterIdentity is not known, but a PublicKey they handle is exposed via the LeaseSet

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`