Commit Graph

22 Commits (5e8e61bb3bde6dd1342315f9fadd06d25479e129)

Author SHA1 Message Date
Jason Ish 1f63e7b7c0 examples: add tx logger to custom logger example
However, its disabled due to issue
https://redmine.openinfosecfoundation.org/issues/7236.

Ticket: #7227
1 month ago
Jason Ish a2779ac916 output-flow: rename register function and document
Rename OutputRegisterFlowLogger to SCOutputRegisterFlowLogger and
document in the header file.

Mark other functions in the header file as part of the internal API.

Ticket: #7227
1 month ago
Jason Ish 7b4271c309 output-packet: rename register function and document
Rename OutputRegisterPacketLogger to SCOutputRegisterPacketLogger as
its part of the public API and document its parameters.

Comment on the other functions in the header that they are part of the
internal API.

Ticket: #7227
1 month ago
Jason Ish 8735c02995 packet-logger: remove ThreadExitPrintStats
The ThreadExitPrintStats callback was never being used, remove.

Ticket: #7227
1 month ago
Jason Ish cdcb395142 examples: add custom logging plugin
Add an example custom logger that hooks into the low level packet and
flow logging callbacks.

Ticket: #7227
1 month ago
Jason Ish 1173bb788e .gitignore: globally ignore .la files
With automake and libraries, these files are creeping in.
3 months ago
Philippe Antoine 4bbe7d92dc detect: helper to have pure rust keywords
detect: make number of keywords dynamic

Ticket: 4683
4 months ago
Jason Ish 02b019d071 examples/capture: fix the slot
Use slot->slot_next, not the slot as passed in.
7 months ago
Jason Ish f104e9cecc suricata: expose and break out configuration loading
Expose LoadYamlConfig as SCLoadYamlConfig and remove it from
SuricataInit. This is required to allow the library user the ability
customize the loading of the configuration, for example doing some
programmatic configuration then loading a configuration file.
7 months ago
Jason Ish 2c71c7fe6a suricata: move SuricataMain into main()
Move the contents of SuricataMain into the `main()` function found in
main.c. This forces the Suricata application to bootstrap and run
Suricata through the same interfaces as a library user might do.

Required exposing StartInternalRunMode as SCStartInternalRunmode. Its
arguable whether those "actions" belong in the library or just the
application, but I think that is separation we can look at later.

For now the lib example and Suricata's own main are the same, however
the example will probably extend more into programmatically
configuring Suricata or dynamically registering a runmode, which
doesn't really belong the main Suricata application.
7 months ago
Jason Ish c476fcc85b suricata: expose FinalizeRunMode and ParseCommandLine
Expose the functions FinalizeRunMode and ParseCommandLine to library
users, renaming with the `SC` prefix in the process.

This involves moving "application" level details from SuricataInit
into SuricataMain, as parsing command line options should be opt-in
for a library user.
7 months ago
Jason Ish 2dc39d31c6 examples/lib: replicate Suricata using the library
With more functions exposed via the library, a library user can now
replicate the Suricata "main" function.
7 months ago
Jason Ish a3354e55e6 eve/filetypes: use more const 7 months ago
Jason Ish eee9757dba eve/filetype: ThreadDeinit can return void
Change ThreadDeinit to return void instead of an int, there is nothing
to be done on success or failure.
7 months ago
Jason Ish bd55cd4c55 eve/filetypes: common init for threaded and non-threaded
In 7.0 if EVE was non-threaded, the ThreadInit for the filetype was
not called meaning that the filetype author had to handle the threaded
and non-threaded cases.

To simplify this, if non-threaded, still call ThreadInit (and
ThreadDeinit) once with a thread_id of 0. This should simplify
authoring EVE filetype plugins.
7 months ago
Jason Ish ead09c2497 eve/filetypes: remove from plugin context
Remove EVE filetypes from plugin context as they are not only used
from plugins. Plugins allow user code to register filetypes, but we
also have internal file types that use this api including the null
output and syslog.  Additionally library users can use this API to
register filetypes, and they are not plugins.

Ideally this code would go in "output-json.[ch]" as the "primary" eve
API, however there are currently some include circular include issues
there, so start new cleaned up EVE API in "output-eve.[ch]" which is
"clean" with respect to includes, and as we cleanup existing EVE API for
"public" use, it can be moved here.

Ticket: #6838
7 months ago
Jeff Lucovsky 3bf92bb14f example/plugin: Use ThreadId 7 months ago
Jason Ish 0dc3de332a examples: minimal example capture plugin for ci
Create a mininal capture plugin that injects one packet. While it can
also be a template, we should be able to run this in CI to test the
loading and registration of the capture plugin mechanisms.
8 months ago
Jason Ish 5ed3f905ac examples/lib: work with bundled libhtp
The simple example Makefile.am was unconditionally including
$(HTP_LDADD) which might be empty resulting in "../.." ending up in the
Makefile causing the build to fail.

Instead, also make HTP_LDADD a conditional, so we can only include it
when actually set, and its only set when libhtp is bundled.

The reason this Makefile needs to include the path components "../.."
is because the HTP_LDADD value is relative to the top level "src/"
directory.
8 months ago
Jason Ish 2421b024f2 examples: program linking against library
Provide an example of an extremely simple application that links
against Suricata. This provides a Makefile integrated with the
Suricata build system for in-tree building, as well as an example
Makefile for building out of tree.

Currently this application just wraps SuricataMain and does nothing
else.
8 months ago
Jason Ish 6d792f017b examples/plugin: simplify Makefile
Simplify the Makefile by avoiding automake and providing our own
Makefile.in that is suitable for in-tree builds of the plugin and can
also serve as an example for standalone plugins.

But the bigger benefit of this is to allow building the example plugin
even with --disable-shared provided to configure, as this is just a
phony limitation imposed by automake/libtool.
8 months ago
Jason Ish d2b25af3f4 examples: add an example plugin of an eve filetype
This is an example of what adding plugin examples to the Suricata repo
could look like.

This plugin is an example plugin for an EVE filetype. It could be
extended to support outputs like Redis, syslog, etc.

There is one issue with adding plugins like this to an autotools
project, the project can't be built with --disable-shared, which is
more of an autotools limitation, and not really a Suricata issue.
Suricata built with --disable-shared will load plugins just fine.

Note that the examples directory was added as DIST_SUBDIRS as we don't
want normal builds to recurse into it and attempt to build the plugin,
its just an example, but we still need to keep distcheck happy.
11 months ago