java.lang.Object
net.i2p.router.message.GarlicMessageHandler
All Implemented Interfaces:
HandlerJobBuilder

public class GarlicMessageHandlerextends Object implements HandlerJobBuilder
Builds jobs to process garlic messages received outside tunnels. Handles floodfill netdb operations and garlic routing for direct peer communications.

This is the handler for garlic message not received down a tunnel, which is the case for floodfills receiving netdb messages. It is not the handler for garlic messages received down a tunnel, as InNetMessagePool short circuits tunnel messages, and those garlic messages are handled in InboundMessageDistributor.

  • Field Details

    • _context

      private final RouterContext _context
      The router handling the message.
    • _msgIDBloomXorLocal

      private final long _msgIDBloomXorLocal
      Xor mask for this router's own message ids.
    • _msgIDBloomXorRouter

      private final long _msgIDBloomXorRouter
      Xor mask for messages from other routers.
    • _msgIDBloomXorTunnel

      private final long _msgIDBloomXorTunnel
      Xor mask for messages arriving through a tunnel.
  • Constructor Details

    • GarlicMessageHandler

      public GarlicMessageHandler(RouterContext context)
      Create a handler that draws a fresh random message-ID XOR mask for each of the local, router and tunnel scopes.
      Parameters:
      context - the router context the built jobs run against
    • GarlicMessageHandler

      public GarlicMessageHandler(RouterContext context, long msgIDBloomXorLocal, long msgIDBloomXorRouter, long msgIDBloomXorTunnel)
      Create a handler using fixed message-ID XOR masks, so the bloom filters can be primed identically across restarts.
      Parameters:
      context - the router context the built jobs run against
      msgIDBloomXorLocal - mask applied to message IDs in the local scope
      msgIDBloomXorRouter - mask applied to message IDs in the router scope
      msgIDBloomXorTunnel - mask applied to message IDs in the tunnel scope
  • Method Details

    • createJob

      public Job createJob(I2NPMessage receivedMessage, RouterIdentity from, Hash fromHash)
      Create and return a job to handle this message.
      Specified by:
      createJob in interface HandlerJobBuilder
      Parameters:
      receivedMessage - I2NP message received
      from - router that sent the message (if available)
      fromHash - hash of the routerIdentity of the router that sent the message (if available)
      Returns:
      a job or null if no particular job is appropriate (in which case, the message should go into the inbound message pool)