class TrivialPreprocessor extends Object implements TunnelGateway.QueuePreprocessor
Modifier and Type | Field and Description |
---|---|
protected RouterContext |
_context |
protected static ByteCache |
_dataCache
Here in tunnels, we take from the cache but never add to it.
|
protected Log |
_log |
protected static int |
IV_SIZE |
static int |
PREPROCESSED_SIZE |
Constructor and Description |
---|
TrivialPreprocessor(RouterContext ctx) |
Modifier and Type | Method and Description |
---|---|
long |
getDelayAmount()
how long do we want to wait before flushing
|
protected static int |
getInstructionAugmentationSize(PendingGatewayMessage msg,
int offset,
int instructionsSize) |
protected static int |
getInstructionsSize(PendingGatewayMessage msg) |
protected void |
notePreprocessing(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
String msg) |
protected void |
preprocess(byte[] fragments,
int fragmentLength)
Wrap the preprocessed fragments with the necessary padding / checksums
to act as a tunnel message.
|
boolean |
preprocessQueue(List<PendingGatewayMessage> pending,
TunnelGateway.Sender sender,
TunnelGateway.Receiver rec)
Return true if there were messages remaining, and we should queue up
a delayed flush to clear them
NOTE: Unused here, see BatchedPreprocessor override, super is not called.
|
protected int |
writeFirstFragment(PendingGatewayMessage msg,
byte[] target,
int offset) |
protected int |
writeSubsequentFragment(PendingGatewayMessage msg,
byte[] target,
int offset) |
protected final RouterContext _context
protected final Log _log
public static final int PREPROCESSED_SIZE
protected static final int IV_SIZE
protected static final ByteCache _dataCache
public TrivialPreprocessor(RouterContext ctx)
public long getDelayAmount()
getDelayAmount
in interface TunnelGateway.QueuePreprocessor
public boolean preprocessQueue(List<PendingGatewayMessage> pending, TunnelGateway.Sender sender, TunnelGateway.Receiver rec)
preprocessQueue
in interface TunnelGateway.QueuePreprocessor
pending
- list of Pending objects for messages either unsent
or partly sent. This list should be update with any
values removed (the preprocessor owns the lock)
Messages are not removed from the list until actually sent.
The status of unsent and partially-sent messages is stored in
the Pending structure.protected void notePreprocessing(long messageId, int numFragments, int totalLength, List<Long> messageIds, String msg)
protected void preprocess(byte[] fragments, int fragmentLength)
fragmentLength
- fragments[0:fragmentLength] is usedprotected int writeFirstFragment(PendingGatewayMessage msg, byte[] target, int offset)
protected int writeSubsequentFragment(PendingGatewayMessage msg, byte[] target, int offset)
protected static int getInstructionsSize(PendingGatewayMessage msg)
protected static int getInstructionAugmentationSize(PendingGatewayMessage msg, int offset, int instructionsSize)