mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
binpac: Adding an interface to manually control the buffering for generated
parsers. This consists of two parts: 1. The generated Flow classes expose their flow buffers via a new method flow_buffer(). 2. Flow buffers get two new methods: // Interface for delayed parsing. Sometimes BinPAC doesn't get the // buffering right and then one can use these to feed parts // individually and assemble them internally. After calling // FinishBuffer(), one can send the uppper-layer flow an FlowEOF() // to trigger parsing. void BufferData(const_byteptr data, const_byteptr end); void FinishBuffer();
This commit is contained in:
parent
ce2b56751b
commit
61cc83affa
3 changed files with 23 additions and 2 deletions
|
@ -8,7 +8,7 @@ namespace binpac {
|
|||
|
||||
class FlowBuffer {
|
||||
public:
|
||||
enum LineBreakStyle {
|
||||
enum LineBreakStyle {
|
||||
CR_OR_LF, // CR or LF or CRLF
|
||||
STRICT_CRLF, // CR followed by LF
|
||||
CR_LF_NUL, // CR or LF or CR-LF or CR-NUL
|
||||
|
@ -20,6 +20,14 @@ public:
|
|||
void NewData(const_byteptr begin, const_byteptr end);
|
||||
void NewGap(int length);
|
||||
|
||||
// Interface for delayed parsing. Sometimes BinPAC doesn't get the
|
||||
// buffering right and then one can use these to feed parts
|
||||
// individually and assemble them internally. After calling
|
||||
// FinishBuffer(), one can send the uppper-layer flow an FlowEOF() to
|
||||
// trigger parsing.
|
||||
void BufferData(const_byteptr data, const_byteptr end);
|
||||
void FinishBuffer();
|
||||
|
||||
// Discard unprocessed data
|
||||
void DiscardData();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue