Commit Graph

15 Commits (23c5fafe5cca764fac6a819ee7d532e5841ff7ef)

Author SHA1 Message Date
Jason Ish 9d5158594f util-device: break into public and private definitions
util-device.h exposes some details that are particularly problematic
for C++, even when wrapped in 'extern "C"'. To address this, break the
header into public and private parts. The public part exposes
LiveDevice as an opaque data structure, while the private header has
the actual definition.

The idea is that only Suricata C source files should include the
private header, it should not be re-included in any other header
file. And this is the header library users should use, however we
don't enforce it with tecnical means, a library user could still
include the private header, but the clue there is in the name.
3 months ago
Victor Julien ff0d609a9f threads: rename function to make scope more clear
SCTmThreadsSlotPktAcqLoopFinish ss now used outside of
just pktacq as well.
3 months ago
Jason Ish 22b77b0c56 conf: prefix conf API with SC 4 months ago
Jason Ish de91a23b18 examples/lib: include cleanup
Requires tm-threads.h.

Ticket: #7240
4 months ago
Jason Ish 461e9110b6 examples/lib: use packet setter functions
Instead of direct field access.

Ticket: #7240
4 months ago
Jason Ish b46e3ebeab examples/lib: use a main loop to wait for exit
Instead of immediately entering shutdown, use SuricataMainLoop to wait
for the end of the pcap.

Ticket: #7240
4 months ago
Jason Ish 04161155ec examples/lib: create threadvars from main thread
This also allows us to remove the sleep, as the ThreadVars are now
guaranteed to be created before PostInit.

Ticket: #7240
4 months ago
Jason Ish b100b42315 examples/lib: update library example for ips drop
Add a release packet callback where the action can be checked for drop.

Ticket: #7240
4 months ago
Jason Ish ad8e8dd0e8 runmodes: typedef runmode enum and use as type
Also remove function to set the library mode. This is easy enough to
do with SCRunmodeSet, and we don't want to add a specific setter for
each and every runmode.

Ticket: #7240
4 months ago
Jason Ish a55dbdfae3 lib: consistent naming style
And add SC prefix.

Ticket: #7240
4 months ago
Jason Ish 04b29aa8d3 lib: take pointer to LiveDevice, not name
In the library capture example, show how the packet counter can be
updated.

Ticket: #7240
4 months ago
Jason Ish 60860e43ac lib: remove global worker id variable
Update ThreadVars creation in lib mode to have the worker_id provided
by the user.

Ticket: #7240
4 months ago
Jason Ish 201b3a6001 lib: rename threadvars creation function
Also use a proper return type (ThreadVars *).

Ticket: #7240
4 months ago
Jason Ish 5e94be63ce examples/lib: better command line handling
Use the more conventional "--" command line handling to separate the
arguments. The first set will be passed to Suricata, and the args
after "--" will be handled by the example. Currently this is a single
PCAP filename, but will be extended to a list of PCAP filenames.

Also hard code logging to the current directory.

Ticket: #7240
4 months ago
Jason Ish 4b715a84cf examples: rename lib capture example to custom
To keep the simple example simple, move the lib based capture method
example to its own example.

Ticket: #7240
4 months ago