net.i2p.router.tunnel.pool

## Class BuildMessageGenerator

- java.lang.Object
- - net.i2p.router.tunnel.pool.BuildMessageGenerator

-     abstract class BuildMessageGenerator
      extends Object

  Fill in the encrypted BuildRequestRecords in a TunnelBuildMessage

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BuildMessageGenerator()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `createRecord(int recordNum, int hop, TunnelBuildMessage msg, TunnelCreatorConfig cfg, Hash replyRouter, long replyTunnel, RouterContext ctx, PublicKey peerKey, Properties props)` Place the asymmetrically encrypted record in the specified record slot, containing the hop's configuration (as well as the reply info, if it is an outbound endpoint)
    `static boolean` | `isBlank(TunnelCreatorConfig cfg, int hop)` Check if a hop should have a blank (random) record.
    `static void` | `layeredEncrypt(I2PAppContext ctx, TunnelBuildMessage msg, TunnelCreatorConfig cfg, List<Integer> order)` Encrypt the records so their hop ident is visible at the appropriate times.

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

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

- - ### Constructor Detail

    - #### BuildMessageGenerator

          BuildMessageGenerator()

  - ### Method Detail

    - #### createRecord

          public static void createRecord(int recordNum,
                                          int hop,
                                          TunnelBuildMessage msg,
                                          TunnelCreatorConfig cfg,
                                          Hash replyRouter,
                                          long replyTunnel,
                                          RouterContext ctx,
                                          PublicKey peerKey,
                                          Properties props)

      Place the asymmetrically encrypted record in the specified record slot, containing the hop's configuration (as well as the reply info, if it is an outbound endpoint)
      Parameters:
        `recordNum` - the record number to place this record in
        `hop` - the hop number for this record
        `msg` - out parameter - the tunnel build message to add the record to
        `cfg` - the tunnel creator configuration
        `replyRouter` - the router to reply to (for OBEP), or null
        `replyTunnel` - the tunnel ID to reply to (for OBEP), or -1
        `ctx` - the router context
        `peerKey` - the public key to encrypt with; if null, record is random data
        `props` - properties to go in the build record, non-null
      Throws:
        `IllegalArgumentException` - if hop bigger than config

    - #### isBlank

          public static boolean isBlank(TunnelCreatorConfig cfg,
                                        int hop)

      Check if a hop should have a blank (random) record. Used for zero-hop tunnels or places where we don't need encryption.
      Parameters:
        `cfg` - the tunnel creator configuration
        `hop` - the hop number to check
      Returns:
        true if the record should be blank

    - #### layeredEncrypt

          public static void layeredEncrypt(I2PAppContext ctx,
                                            TunnelBuildMessage msg,
                                            TunnelCreatorConfig cfg,
                                            List<Integer> order)

      Encrypt the records so their hop ident is visible at the appropriate times. Note that this layer-encrypts the build records for the message in-place. Only call this once for a given message.
      Parameters:
        `ctx` - the I2P application context
        `msg` - the tunnel build message to encrypt records in
        `cfg` - the tunnel creator configuration
        `order` - list of hop #s as Integers. For instance, if (order.get(1) is 4), it is peer cfg.getPeer(4)