abstract class TunnelGateway extends Object
| Modifier and Type | Class and Description |
|---|---|
protected class | TunnelGateway.DelayedFlushDelayedFlush. |
static interface | TunnelGateway.QueuePreprocessorInterface for preprocessing queued tunnel messages. |
static interface | TunnelGateway.ReceiverInterface for receiving encrypted tunnel data. |
static interface | TunnelGateway.SenderInterface for sending preprocessed tunnel data. |
| Modifier and Type | Field and Description |
|---|---|
protected RouterContext | _contextrouter context |
protected TunnelGateway.DelayedFlush | _delayedFlushdelayed flush timer |
protected long | _lastFlushlast flush time |
protected Log | _loglog instance |
protected int | _messagesSentmessages sent count |
protected TunnelGateway.QueuePreprocessor | _preprocessorqueue preprocessor |
protected List<PendingGatewayMessage> | _queuemessage queue |
protected TunnelGateway.Receiver | _receiverreceiver |
protected TunnelGateway.Sender | _sendersender |
| Modifier | Constructor and Description |
|---|---|
protected | TunnelGateway(RouterContext context,
TunnelGateway.QueuePreprocessor preprocessor,
TunnelGateway.Sender sender,
TunnelGateway.Receiver receiver)Creates a new TunnelGateway. |
| Modifier and Type | Method and Description |
|---|---|
boolean | add(I2NPMessage msg,
Hash toRouter,
TunnelId toTunnel)Add a message to be sent down the tunnel, either sending it now (perhaps
coalesced with other pending messages) or after a brief pause (_flushFrequency). |
boolean | add(TunnelGatewayMessage msg)Add a message to be sent down the tunnel, where we are the inbound gateway. |
int | getMessagesSent()Get the number of messages sent. |
protected final RouterContext _context
protected final TunnelGateway.DelayedFlush _delayedFlush
protected long _lastFlush
protected final Log _log
protected int _messagesSent
protected final TunnelGateway.QueuePreprocessor _preprocessor
protected final List<PendingGatewayMessage> _queue
protected final TunnelGateway.Receiver _receiver
protected final TunnelGateway.Sender _sender
protected TunnelGateway(RouterContext context, TunnelGateway.QueuePreprocessor preprocessor, TunnelGateway.Sender sender, TunnelGateway.Receiver receiver)
context - the router contextpreprocessor - this pulls Pending messages off a list, builds some
full preprocessed messages, and pumps those into the sendersender - this takes a preprocessed message, encrypts it, and sends it to
the receiverreceiver - this receives the encrypted message and forwards it off
to the first hoppublic boolean add(I2NPMessage msg, Hash toRouter, TunnelId toTunnel)
msg - message to be sent through the tunneltoRouter - router to send to after the endpoint (or null for endpoint processing)toTunnel - tunnel to send to after the endpoint (or null for endpoint or router processing)public boolean add(TunnelGatewayMessage msg)
msg - message received to be sent through the tunnelpublic int getMessagesSent()