This buffer allows to search, replace or remove data in the packets buffered as in a contiguous flow. It also allows to determine if a pattern could be starting at the end of the last packet in the buffer and thus if buffering more packets is required to make a decision.
More...
#include <flowbuffer.hh>
|
| | FlowBuffer () |
| | Construct a FlowBuffer The FlowBuffer must be initialized.
|
| |
| | ~FlowBuffer () |
| | Destruct a FlowBuffer.
|
| |
| MemoryPool< struct flowBufferEntry > * | getMemoryPool () |
| | Return a pointer to the MemoryPool used by this FlowBuffer.
|
| |
| void | enqueue (Packet *packet) |
| | Enqueue a packet at the end of the buffer.
|
| |
| Packet * | dequeue () |
| | Dequeue a packet from the beginning of the buffer @returnt The dequeued packet.
|
| |
| PacketBatch * | dequeueAll () |
| | Dequeue all packets @returnt The dequeued packet.
|
| |
| PacketBatch * | dequeueUpTo (Packet *) |
| | Dequeue packet up to the given one, not included @returnt The dequeued packet.
|
| |
| int | getSize () |
| | Return the size of the buffer.
|
| |
| FlowBufferIter | begin () |
| | Return an iterator pointing to the first packet of the buffer.
|
| |
| FlowBufferIter | end () |
| | Return an iterator pointing to the end of the buffer.
|
| |
| int | searchInFlow (const char *pattern) |
| | Search a pattern in the buffer.
|
| |
| int | removeInFlow (const char *pattern, const int pattern_length, CTXElement *remove) |
| | Remove a pattern in the buffer.
|
| |
| int | replaceInFlow (FlowBufferContentIter pos, const int pattern_length, const char *replacement, const int replacement_length, const bool repeat, CTXElement *owner) |
| | Replace a pattern in the buffer.
|
| |
| FlowBufferContentIter | contentBegin (int posInFirstPacket=0) |
| | Return a content iterator pointing to the first byte of content in the buffer.
|
| |
| FlowBufferContentIter | contentEnd () |
| | Return a content iterator pointing after the end of the content in the buffer.
|
| |
| void | enqueueAll (PacketBatch *batch) |
| | Ensure a flow buffer is initialized and enqueue all packets.
|
| |
|
FlowBufferContentIter | enqueueAllIter (PacketBatch *batch) |
| |
|
FlowBufferChunkIter | enqueueAllChunkIter (PacketBatch *batch) |
| |
| FlowBufferContentIter | search (FlowBufferContentIter start, const char *pattern, int *feedback) |
| | Search a pattern in the buffer.
|
| |
|
FlowBufferContentIter | isearch (FlowBufferContentIter start, const char *pattern, int *feedback) |
| |
|
FlowBufferContentIter | searchSSE (FlowBufferContentIter start, const char *pattern, const int pattern_length, int *feedback) |
| |
| void | remove (const FlowBufferContentIter start, uint32_t length, CTXElement *owner) |
| | Remove data in the flow (across the packets)
|
| |
This buffer allows to search, replace or remove data in the packets buffered as in a contiguous flow. It also allows to determine if a pattern could be starting at the end of the last packet in the buffer and thus if buffering more packets is required to make a decision.
◆ FlowBuffer()
| FlowBuffer::FlowBuffer |
( |
| ) |
|
◆ ~FlowBuffer()
| FlowBuffer::~FlowBuffer |
( |
| ) |
|
Destruct a FlowBuffer.
Don't forget to call this operator when the FCB is released
◆ getMemoryPool()
| MemoryPool< struct flowBufferEntry > * FlowBuffer::getMemoryPool |
( |
| ) |
|
◆ enqueue()
| void FlowBuffer::enqueue |
( |
Packet * |
packet | ) |
|
Enqueue a packet at the end of the buffer.
- Parameters
-
| packet | The packet to enqueue |
◆ dequeue()
| Packet * FlowBuffer::dequeue |
( |
| ) |
|
Dequeue a packet from the beginning of the buffer @returnt The dequeued packet.
◆ dequeueAll()
Dequeue all packets @returnt The dequeued packet.
◆ dequeueUpTo()
Dequeue packet up to the given one, not included @returnt The dequeued packet.
◆ getSize()
| int FlowBuffer::getSize |
( |
| ) |
|
Return the size of the buffer.
- Returns
- The number of packets in the buffer
◆ begin()
Return an iterator pointing to the first packet of the buffer.
- Returns
- An iterator pointing to the first packet of the buffer
◆ end()
Return an iterator pointing to the end of the buffer.
- Returns
- An iterator pointing to the end of the buffer
◆ searchInFlow()
| int FlowBuffer::searchInFlow |
( |
const char * |
pattern | ) |
|
Search a pattern in the buffer.
- Parameters
-
| pattern | The pattern to search |
- Returns
- 1 if the pattern has been found, -1 if the pattern has not been found and cannot start in the last packet of the buffer, 0 if the pattern has not been found but the pattern could start at the end of the last packet in the buffer and thus enqueuing the next packet could result in a match.
◆ removeInFlow()
| int FlowBuffer::removeInFlow |
( |
const char * |
pattern, |
|
|
const int |
pattern_length, |
|
|
CTXElement * |
remove |
|
) |
| |
Remove a pattern in the buffer.
- Parameters
-
| fcb | A pointer to the FCB of this flow |
| The | pattern to remove |
- Returns
- 1 if the pattern has been found and the first occurrence has been removed -1 if the pattern has not been found and cannot start in the last packet of the buffer 0 if the pattern has not been found but the pattern could start at the end of the last packet in the buffer and thus enqueuing the next packet could result in a match.
◆ replaceInFlow()
| int FlowBuffer::replaceInFlow |
( |
FlowBufferContentIter |
pos, |
|
|
const int |
pattern_length, |
|
|
const char * |
replacement, |
|
|
const int |
replacement_length, |
|
|
const bool |
repeat, |
|
|
CTXElement * |
owner |
|
) |
| |
Replace a pattern in the buffer.
- Parameters
-
| fcb | A pointer to the FCB of this flow |
| The | pattern to replace |
| The | new data that will replace the old one |
- Returns
- 1 if the pattern has been found and the first occurrence has been replaced -1 if the pattern has not been found and cannot start in the last packet of the buffer 0 if the pattern has not been found but the pattern could start at the end of the last packet in the buffer and thus enqueuing the next packet could result in a match.
◆ contentBegin()
Return a content iterator pointing to the first byte of content in the buffer.
- Returns
- A content iterator pointing to the first byte of content in the buffer
◆ contentEnd()
Return a content iterator pointing after the end of the content in the buffer.
- Returns
- A content iterator pointing after the end of the content in the buffer
◆ enqueueAll()
Ensure a flow buffer is initialized and enqueue all packets.
◆ search()
Search a pattern in the buffer.
- Parameters
-
| start | Content iterator indicating where to start the search |
| pattern | The pattern to search |
| feedback | An int in which the result of the search will be put (1 if found, -1 if not found, 0 if not found but could start at the end of the last packet) |
- Returns
- An iterator pointing to the beginning of the pattern in the flow if found or after the end of the content if not found
◆ remove()
Remove data in the flow (across the packets)
- Parameters
-
| fcb | A pointer to the FCB of the flow |
| start | A content iterator pointing to the first byte to remove |
| length | The number of bytes to remove |
The documentation for this class was generated from the following files: