net.i2p.router.message

## Class GarlicMessageBuilder

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

-     public class GarlicMessageBuilder
      extends Object

  Build garlic messages based on a GarlicConfig

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GarlicMessageBuilder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static GarlicMessage` | `buildMessage(RouterContext ctx, GarlicConfig config, SessionKey wrappedKey, Set<SessionTag> wrappedTags, int numTagsToDeliver, int lowTagsThreshold, boolean forceElGamal, SessionKeyManager skm)` called by netdb
    `static GarlicMessage` | `buildMessage(RouterContext ctx, GarlicConfig config, SessionKey wrappedKey, Set<SessionTag> wrappedTags, PublicKey target, SessionKey encryptKey, SessionTag encryptTag)` used by TestJob and directly above
    `static GarlicMessage` | `buildMessage(RouterContext ctx, GarlicConfig config, SessionKey wrappedKey, Set<SessionTag> wrappedTags, SessionKeyManager skm)` called by OCMJH
    `static int` | `estimateAvailableTags(RouterContext ctx, PublicKey key, Hash local)`

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

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

- - ### Constructor Detail

    - #### GarlicMessageBuilder

          public GarlicMessageBuilder()

  - ### Method Detail

    - #### estimateAvailableTags

          public static int estimateAvailableTags(RouterContext ctx,
                                  PublicKey key,
                                  Hash local)

      Parameters:
        `local` - non-null; do not use this method for the router's SessionKeyManager

    - #### buildMessage

          public static GarlicMessage buildMessage(RouterContext ctx,
                                   GarlicConfig config,
                                   SessionKey wrappedKey,
                                   Set<SessionTag> wrappedTags,
                                   SessionKeyManager skm)

      called by OCMJH
      Parameters:
        `ctx` - scope
        `config` - how/what to wrap
        `wrappedKey` - output parameter that will be filled with the sessionKey used
        `wrappedTags` - output parameter that will be filled with the sessionTags used
        `skm` - non-null

    - #### buildMessage

          public static GarlicMessage buildMessage(RouterContext ctx,
                                   GarlicConfig config,
                                   SessionKey wrappedKey,
                                   Set<SessionTag> wrappedTags,
                                   int numTagsToDeliver,
                                   int lowTagsThreshold,
                                   boolean forceElGamal,
                                   SessionKeyManager skm)

      called by netdb
      Parameters:
        `ctx` - scope
        `config` - how/what to wrap
        `wrappedKey` - output parameter that will be filled with the sessionKey used
        `wrappedTags` - output parameter that will be filled with the sessionTags used
        `numTagsToDeliver` - only if the estimated available tags are below the threshold
        `lowTagsThreshold` - the threshold
        `skm` - non-null

    - #### buildMessage

          public static GarlicMessage buildMessage(RouterContext ctx,
                                   GarlicConfig config,
                                   SessionKey wrappedKey,
                                   Set<SessionTag> wrappedTags,
                                   PublicKey target,
                                   SessionKey encryptKey,
                                   SessionTag encryptTag)

      used by TestJob and directly above
      Parameters:
        `ctx` - scope
        `config` - how/what to wrap
        `wrappedKey` - unused - why??
        `wrappedTags` - output parameter that will be filled with the sessionTags used
        `target` - public key of the location being garlic routed to (may be null if we know the encryptKey and encryptTag)
        `encryptKey` - sessionKey used to encrypt the current message
        `encryptTag` - sessionTag used to encrypt the current message