Commit graph

10 commits

Author SHA1 Message Date
Jon Siwek
21cf20fc6f binpac: Improve storage type used for case-type index
The type used to store the index for a case-type now tracks the
type of the index expression rather than always using an "int".

The case fields also now have some checking done at code-gen-time to
ensure the constants used for cases does not exceed the numeric limit
of the type used in the case's index expression.  Then, assuming, it
looks safe, the C++ case labels are generated with casts to the type
of the Binpac case's index expression to ensure compilers accept it
(since all Binpac numbers use "int" for storage/printing internally).
2025-08-20 08:52:23 -07:00
Jon Siwek
b4b229acf7 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.
2025-08-20 08:52:23 -07:00
Jon Siwek
8a1c8db02e binpac: BIT-1914: move &check implementation to new &enforce attribute
&check returns to being a no-op to avoid unintentionally
breaking existing code.
2025-08-20 08:52:23 -07:00
Jon Siwek
0ecf7755ea binpac: BIT-1914: Implement &check
Patch submitted by Antoine
2025-08-20 08:52:23 -07:00
Jon Siwek
cb524c2fde binpac: Fix two use-after-free bugs. 2025-08-20 08:52:23 -07:00
Jon Siwek
c8665318e6 binpac: Initial import of Bro's binpac subdirectory from SVN r7088. 2025-08-20 08:52:22 -07:00
Tim Wojtulewicz
e64ec54172
Revert "Move BinPAC, bifcl, af_packet, and gen_zam submodules into main zeek repo" 2025-08-15 15:11:22 -07:00
Tim Wojtulewicz
cd1414ab69 Fix clang-tidy findings in the binpac lib code 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
4ae8bb856d Add copyright headers to all of the binpac source files 2025-08-15 13:57:27 -07:00
Tim Wojtulewicz
ff26835976 Move binpac code into the main Zeek repository
This is based on commit 48f75b5f6415fe9d597e3e991cec635b1bc400dc from
the binpac repository.
2025-08-15 13:57:27 -07:00