Skip to content

Commit

Permalink
example/plugin: Use ThreadId
Browse files Browse the repository at this point in the history
  • Loading branch information
jlucovsky committed Jan 7, 2024
1 parent 02853f6 commit 182a567
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/plugins/c-json-filetype/Makefile.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SRCS := filetype.c

LIBSURICATA_CONFIG ?= libsuricata-config

CPPFLAGS += -I../../../src
CPPFLAGS += `$(LIBSURICATA_CONFIG) --cflags`
CPPFLAGS += -DSURICATA_PLUGIN -I.
CPPFLAGS += "-D__SCFILENAME__=\"$(*F)\""
Expand Down
6 changes: 3 additions & 3 deletions examples/plugins/c-json-filetype/filetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

#define FILETYPE_NAME "json-filetype-plugin"

static int FiletypeThreadInit(void *ctx, int thread_id, void **thread_data);
static int FiletypeThreadInit(void *ctx, ThreadId thread_id, void **thread_data);
static int FiletypeThreadDeinit(void *ctx, void *thread_data);

/**
* Per thread context data for each logging thread.
*/
typedef struct ThreadData_ {
/** The thread ID, for demonstration purposes only. */
int thread_id;
ThreadId thread_id;

/** The number of records logged on this thread. */
uint64_t count;
Expand Down Expand Up @@ -143,7 +143,7 @@ static void FiletypeDeinit(void *data)
* Suricata, but instead this plugin chooses to use this method to create a
* default (single) thread context.
*/
static int FiletypeThreadInit(void *ctx, int thread_id, void **thread_data)
static int FiletypeThreadInit(void *ctx, ThreadId thread_id, void **thread_data)
{
ThreadData *tdata = SCCalloc(1, sizeof(ThreadData));
if (tdata == NULL) {
Expand Down

0 comments on commit 182a567

Please sign in to comment.