mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
binpac: Add FlowBuffer policy mechanisms
This allows for tunability of the following behaviors: * Minimum flowbuffer capacity to use when parsing a new unit * Threshold at which flowbuffer capacity is contracted back to the minimum after parsing a complete unit and before parsing the next * Maximum flowbuffer capacity to allow when parsing a given unit Failed flowbuffer allocations due to reaching maximum capacity or any other reason now throw ExceptionFlowBufferAlloc.
This commit is contained in:
parent
7e6e24a4d8
commit
b4b229acf7
4 changed files with 73 additions and 13 deletions
|
@ -13,7 +13,8 @@ namespace binpac
|
|||
//
|
||||
// Note, this must be declared/defined here, and inline, because the RE
|
||||
// functionality can only be used when compiling from inside Bro.
|
||||
inline void init();
|
||||
// A copy is made of any FlowBuffer policy struct data passed.
|
||||
inline void init(FlowBuffer::Policy* fbp = 0);
|
||||
|
||||
// Internal vector recording not yet compiled matchers.
|
||||
extern std::vector<RE_Matcher*>* uncompiled_re_matchers;
|
||||
|
@ -42,7 +43,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
friend void ::binpac::init();
|
||||
friend void ::binpac::init(FlowBuffer::Policy*);
|
||||
|
||||
// Function, and state, for compiling matchers.
|
||||
static void init();
|
||||
|
@ -68,9 +69,12 @@ inline void RegExMatcher::init()
|
|||
uncompiled_re_matchers->clear();
|
||||
}
|
||||
|
||||
inline void init()
|
||||
inline void init(FlowBuffer::Policy* fbp)
|
||||
{
|
||||
RegExMatcher::init();
|
||||
|
||||
if ( fbp )
|
||||
FlowBuffer::init(*fbp);
|
||||
}
|
||||
|
||||
} // namespace binpac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue