java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.message.HandleGarlicMessageJob
All Implemented Interfaces:
Job, GarlicMessageReceiver.CloveReceiver

public class HandleGarlicMessageJobextends JobImpl implements GarlicMessageReceiver.CloveReceiver
Job to handle an inbound GarlicMessage received outside of a tunnel.

Decrypts the garlic message and processes each contained clove. Local-message cloves are added directly to the inbound message pool, while cloves destined for other routers or tunnels are forwarded accordingly.

This class handles garlic messages received directly (not down a tunnel), e.g., in floodfill routers receiving network database messages.

Implements GarlicMessageReceiver.CloveReceiver to receive and process individual cloves. Public visibility is necessary for integration with the job queue system.

  • Field Details

    • _log

      private final Log _log
      Logger for this class.
    • _message

      private final GarlicMessage _message
      The garlic message being processed.
    • _msgIDBloomXorLocal

      private final long _msgIDBloomXorLocal
      Bloom mask for the local message id.
    • _msgIDBloomXorRouter

      private final long _msgIDBloomXorRouter
      Bloom mask for the router's message id.
    • _msgIDBloomXorTunnel

      private final long _msgIDBloomXorTunnel
      Bloom mask for the tunnel's message id.
    • ROUTER_PRIORITY

      private static final int ROUTER_PRIORITY
      Priority of replies sent by the router.
      See Also:
    • TUNNEL_PRIORITY

      private static final int TUNNEL_PRIORITY
      Priority of replies sent through the tunnel.
      See Also:
  • Constructor Details

    • HandleGarlicMessageJob

      public HandleGarlicMessageJob(RouterContext context, GarlicMessage msg, RouterIdentity from, Hash fromHash, long msgIDBloomXorLocal, long msgIDBloomXorRouter, long msgIDBloomXorTunnel)
      Job to handle an inbound garlic message received outside of a tunnel.
      Parameters:
      context - router context providing core services
      msg - garlic message to process
      from - sending router identity (sender identity)
      fromHash - sending router hash (sender hash)
      msgIDBloomXorLocal - long unique to router/session for XOR with message ID in local inbound messages
      msgIDBloomXorRouter - long unique to router/session for XOR with message ID in router-targeted messages
      msgIDBloomXorTunnel - long unique to router/session for XOR with message ID in tunnel-targeted messages
  • Method Details

    • getName

      public String getName()
      Returns a descriptive name for this job.
      Specified by:
      getName in interface Job
      Returns:
      Name of the job.
    • runJob

      public void runJob()
      Entry point for the job. Creates an instance of GarlicMessageReceiver configured to use this job as the clove receiver, then processes the garlic message.
      Specified by:
      runJob in interface Job
    • handleClove

      public void handleClove(DeliveryInstructions instructions, I2NPMessage data)
      Handle each garlic clove based on its delivery instructions.

      Local delivery cloves are added to the inbound message pool with a XOR mask for the message ID. Router delivery cloves are either queued locally or forwarded directly. Tunnel delivery cloves are wrapped in a TunnelGatewayMessage and forwarded.

      Specified by:
      handleClove in interface GarlicMessageReceiver.CloveReceiver
      Parameters:
      instructions - Delivery instructions specifying the target for this clove.
      data - The message contained in the clove.
    • dropped

      public void dropped()
      Called when this job has been dropped (e.g. due to queue overload). Records an error in message history indicating the message was dropped.
      Specified by:
      dropped in interface Job
      Overrides:
      dropped in class JobImpl