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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GarlicConfig()`

  - ### Method Summary

    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()`
    `GarlicConfig` | `getClove(int index)`
    `int` | `getCloveCount()`
    `DeliveryInstructions` | `getDeliveryInstructions()`
    `long` | `getExpiration()`
    `long` | `getId()`
    `RouterInfo` | `getRecipient()`
    `PublicKey` | `getRecipientPublicKey()`
    `Certificate` | `getReplyBlockCertificate()`
    `long` | `getReplyBlockExpiration()`
    `long` | `getReplyBlockMessageId()`
    `DeliveryInstructions` | `getReplyInstructions()`
    `RouterInfo` | `getReplyThroughRouter()`
    `boolean` | `getRequestAck()`
    `protected String` | `getSubData()`
    `void` | `setCertificate(Certificate cert)` Certificate for the getRecipient() to pay for their processing
    `void` | `setDeliveryInstructions(DeliveryInstructions instructions)` Specify how the I2NPMessage in the clove should be handled.
    `void` | `setExpiration(long expiration)` Expiration of the clove, after which it should be dropped
    `void` | `setId(long id)` Unique ID of the clove
    `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.
    `void` | `setReplyBlockCertificate(Certificate cert)`
    `void` | `setReplyBlockExpiration(long expiration)`
    `void` | `setReplyBlockMessageId(long id)`
    `void` | `setReplyInstructions(DeliveryInstructions instructions)` Specify how any reply will be routed so that it reaches this router after being delivered to the getReplyThroughRouter.
    `void` | `setReplyThroughRouter(RouterInfo replyThroughRouter)` Specify the router through which a reply to this clove can be sent.
    `void` | `setRequestAck(boolean request)` If true, the recipient of this clove is requested to send a DeliveryStatusMessage back via the replyThroughRouter using the getId() value for the status' message Id.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### GarlicConfig

          public GarlicConfig()

  - ### Method Detail

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

    - #### getRecipient

          public RouterInfo getRecipient()

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

    - #### getRecipientPublicKey

          public PublicKey getRecipientPublicKey()

    - #### setCertificate

          public void setCertificate(Certificate cert)

      Certificate for the getRecipient() to pay for their processing

    - #### getCertificate

          public Certificate getCertificate()

    - #### setId

          public void setId(long id)

      Unique ID of the clove

    - #### getId

          public long getId()

    - #### setExpiration

          public void setExpiration(long expiration)

      Expiration of the clove, after which it should be dropped

    - #### getExpiration

          public long getExpiration()

    - #### setDeliveryInstructions

          public void setDeliveryInstructions(DeliveryInstructions instructions)

      Specify how the I2NPMessage in the clove should be handled.

    - #### getDeliveryInstructions

          public DeliveryInstructions getDeliveryInstructions()

    - #### setRequestAck

          public void setRequestAck(boolean request)

      If true, the recipient of this clove is requested to send a DeliveryStatusMessage back via the replyThroughRouter using the getId() value for the status' message Id. Since those reply blocks are good for one use only, this flag should only be set if no reply is expected.

    - #### getRequestAck

          public boolean getRequestAck()

    - #### setReplyThroughRouter

          public void setReplyThroughRouter(RouterInfo replyThroughRouter)

      Specify the router through which a reply to this clove can be sent. The getReplyInstructions() are passed to this router during the reply process and it them uses those to send the reply to this router.

    - #### getReplyThroughRouter

          public RouterInfo getReplyThroughRouter()

    - #### setReplyInstructions

          public void setReplyInstructions(DeliveryInstructions instructions)

      Specify how any reply will be routed so that it reaches this router after being delivered to the getReplyThroughRouter. These instructions are not exposed to the router who receives this garlic message in cleartext - they are instead encrypted to the replyThrough router

    - #### getReplyInstructions

          public DeliveryInstructions getReplyInstructions()

    - #### getReplyBlockMessageId

          public long getReplyBlockMessageId()

    - #### setReplyBlockMessageId

          public void setReplyBlockMessageId(long id)

    - #### getReplyBlockCertificate

          public Certificate getReplyBlockCertificate()

    - #### setReplyBlockCertificate

          public void setReplyBlockCertificate(Certificate cert)

    - #### getReplyBlockExpiration

          public long getReplyBlockExpiration()

    - #### setReplyBlockExpiration

          public void setReplyBlockExpiration(long expiration)

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

    - #### getCloveCount

          public int getCloveCount()

    - #### getClove

          public GarlicConfig getClove(int index)

    - #### clearCloves

          public void clearCloves()

    - #### getSubData

          protected String getSubData()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`