java.lang.Object
net.i2p.router.tunnel.HopProcessor
- Direct Known Subclasses:
InboundGatewayProcessor
Take a received tunnel message, verify that it isn't a duplicate, and translate it into what the next hop will want. The hop processor works the same on all peers - inbound and outbound participants, outbound endpoints, and inbound gateways (with a small modification per InboundGatewayProcessor).
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HopConfigConfig for this hop, holding the IV and layer keys and the expected previous hop.protected final I2PAppContextRouter or client context, supplying the log and the AES engine.(package private) static final intLength in bytes of the per-hop IV preceding the message data (16).Constructor Summary
ConstructorsConstructorDescriptionHopProcessor(I2PAppContext ctx, HopConfig config, IVValidator validator) Create a processor for a single hop of a tunnel.Method Summary
All Methods
Field Details
_context
Router or client context, supplying the log and the AES engine._config
Config for this hop, holding the IV and layer keys and the expected previous hop.IV_LENGTH
static final int IV_LENGTHLength in bytes of the per-hop IV preceding the message data (16). The tunnel crypto encrypts the IV both before and after using it at each hop so as to prevent a certain type of replay/confirmation attack.See: http://osdir.com/ml/network.i2p/2005-07/msg00031.html
- See Also:
Constructor Details
HopProcessor
Create a processor for a single hop of a tunnel.- Parameters:
ctx- the router or client contextconfig- this hop's tunnel configvalidator- checks that the message IV is one we have not seen
Method Details
process
Process the data for the current hop, overwriting the original data with what should be sent to the next peer. This also validates the previous peer and the IV, making sure its not a repeat and not a loop.- Parameters:
orig- IV+data of the messageoffset- index into orig where the IV beginslength- how long after the offset does the IV+message go for? Should always be 1024 bytes.prev- previous hop in the tunnel, or null if we are the gateway- Returns:
- true if the message was updated and valid, false if it was not.
toString