mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +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
|
@ -137,6 +137,19 @@ void FlowBuffer::NewFrame(int frame_length, bool chunked)
|
|||
MarkOrCopyFrame();
|
||||
}
|
||||
|
||||
void FlowBuffer::BufferData(const_byteptr data, const_byteptr end)
|
||||
{
|
||||
mode_ = FRAME_MODE;
|
||||
frame_length_ += (end - data);
|
||||
MarkOrCopyFrame();
|
||||
NewData(data, end);
|
||||
}
|
||||
|
||||
void FlowBuffer::FinishBuffer()
|
||||
{
|
||||
message_complete_ = true;
|
||||
}
|
||||
|
||||
void FlowBuffer::GrowFrame(int length)
|
||||
{
|
||||
BINPAC_ASSERT(frame_length_ >= 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue