net.i2p.router.tunnel

## Class HopConfig

- java.lang.Object
- - net.i2p.router.tunnel.HopConfig

-     public class HopConfig
      extends Object

  Defines the general configuration for a hop in a tunnel. This is used for both participating tunnels and tunnels we create. Data only stored for tunnels we create should be in TunnelCreatorConfig to save space.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HopConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAllocatedBW()`
    `(package private) int` | `getAndResetRecentMessagesCount()` This returns the number of processed messages since the last time this was called, and resets the count.
    `long` | `getCreation()` when was this tunnel created (in ms since the epoch)?
    `long` | `getExpiration()` when does this tunnel expire (in ms since the epoch)?
    `SessionKey` | `getIVKey()` what key should we use to encrypt the preIV before passing it on?
    `SessionKey` | `getLayerKey()` what key should we use to encrypt the layer before passing it on?
    `int` | `getProcessedMessagesCount()`
    `Hash` | `getReceiveFrom()` what is the previous peer in the tunnel (null if gateway)
    `TunnelId` | `getReceiveTunnel()` What tunnel ID are we receiving on? (null if uninitialized)
    `long` | `getReceiveTunnelId()` What tunnel ID are we receiving on? (0 if uninitialized)
    `int` | `getRecentMessagesCount()` This returns the number of processed messages since the last time getAndResetRecentMessagesCount() was called.
    `Hash` | `getSendTo()` what is the next peer in the tunnel (null if endpoint)
    `TunnelId` | `getSendTunnel()` What is the next tunnel ID we are sending to? (null if endpoint)
    `long` | `getSendTunnelId()` What is the next tunnel ID we are sending to? (0 if endpoint)
    `void` | `incrementProcessedMessages()` Take note of a message being pumped through this tunnel.
    `void` | `setAllocatedBW(int bw)`
    `void` | `setCreation(long when)`
    `void` | `setExpiration(long when)`
    `void` | `setIVKey(SessionKey key)`
    `void` | `setLayerKey(SessionKey key)`
    `void` | `setReceiveFrom(Hash from)` Do not set for gateway
    `void` | `setReceiveTunnelId(long id)`
    `void` | `setReceiveTunnelId(TunnelId id)`
    `void` | `setSendTo(Hash to)` Do not set for endpoint
    `void` | `setSendTunnelId(long id)` Do not set for endpoint
    `void` | `setSendTunnelId(TunnelId id)` Do not set for endpoint
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### HopConfig

          public HopConfig()

  - ### Method Detail

    - #### getAllocatedBW

          public int getAllocatedBW()

      Returns:
        Bps

    - #### getAndResetRecentMessagesCount

          int getAndResetRecentMessagesCount()

      This returns the number of processed messages since the last time this was called, and resets the count. It should only be called by code that updates the router stats. See TunnelDispatcher.updateParticipatingStats().

    - #### getCreation

          public long getCreation()

      when was this tunnel created (in ms since the epoch)?

    - #### getExpiration

          public long getExpiration()

      when does this tunnel expire (in ms since the epoch)?

    - #### getIVKey

          public SessionKey getIVKey()

      what key should we use to encrypt the preIV before passing it on?

    - #### getLayerKey

          public SessionKey getLayerKey()

      what key should we use to encrypt the layer before passing it on?

    - #### getProcessedMessagesCount

          public int getProcessedMessagesCount()

    - #### getReceiveFrom

          public Hash getReceiveFrom()

      what is the previous peer in the tunnel (null if gateway)

    - #### getReceiveTunnel

          public TunnelId getReceiveTunnel()

      What tunnel ID are we receiving on? (null if uninitialized)

    - #### getReceiveTunnelId

          public long getReceiveTunnelId()

      What tunnel ID are we receiving on? (0 if uninitialized)

    - #### getRecentMessagesCount

          public int getRecentMessagesCount()

      This returns the number of processed messages since the last time getAndResetRecentMessagesCount() was called. As of 0.9.23, does NOT reset the count, see getAndResetRecentMessagesCount().

    - #### getSendTo

          public Hash getSendTo()

      what is the next peer in the tunnel (null if endpoint)

    - #### getSendTunnel

          public TunnelId getSendTunnel()

      What is the next tunnel ID we are sending to? (null if endpoint)

    - #### getSendTunnelId

          public long getSendTunnelId()

      What is the next tunnel ID we are sending to? (0 if endpoint)

    - #### incrementProcessedMessages

          public void incrementProcessedMessages()

      Take note of a message being pumped through this tunnel. "processed" is for incoming and "sent" is for outgoing (could be dropped in between) We use synchronization instead of an AtomicInteger here to save space.

    - #### setAllocatedBW

          public void setAllocatedBW(int bw)

      Parameters:
        `bw` - Bps

    - #### setCreation

          public void setCreation(long when)

    - #### setExpiration

          public void setExpiration(long when)

    - #### setIVKey

          public void setIVKey(SessionKey key)

    - #### setLayerKey

          public void setLayerKey(SessionKey key)

    - #### setReceiveFrom

          public void setReceiveFrom(Hash from)

      Do not set for gateway

    - #### setReceiveTunnelId

          public void setReceiveTunnelId(long id)

      Parameters:
        `id` - 1 to 0xffffffff
      Throws:
        `IllegalArgumentException` - if less than or equal to zero or greater than max value

    - #### setReceiveTunnelId

          public void setReceiveTunnelId(TunnelId id)

    - #### setSendTo

          public void setSendTo(Hash to)

      Do not set for endpoint

    - #### setSendTunnelId

          public void setSendTunnelId(long id)

      Do not set for endpoint
      Parameters:
        `id` - 1 to 0xffffffff
      Throws:
        `IllegalArgumentException` - if less than or equal to zero or greater than max value

    - #### setSendTunnelId

          public void setSendTunnelId(TunnelId id)

      Do not set for endpoint

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`