zeek / spicy

C++ parser generator for dissecting protocols & files.
https://docs.zeek.org/projects/spicy
Other
243 stars 37 forks source link

Call `%sync_advance` hook also when entering sync mode. #1773

Closed bbannier closed 1 month ago

bbannier commented 2 months ago

This allows users to control the full synchronization lifecycle, from entering it, to regular checks during the search (both via %sync_advance, until it is left (via their explicit confirm, e.g., from a %synced hook).

bbannier commented 1 month ago

Looks good now, just one suggestion: factor out pb->guardFeatureCode() ... { ... } into a separate method to avoid duplicating the code 3x, for easier maintenance in the future.

I was thinking about introducing that helper, but was unsure whether that would make things much easier since the hook invocations during advancing inject an additional condition. I added a helper, let me know what you think.