eve/filetypes: use more const

pull/10652/head
Jason Ish 2 years ago committed by Victor Julien
parent eee9757dba
commit a3354e55e6

@ -64,7 +64,7 @@ typedef struct Context_ {
* configuration for the eve instance, not just a node named after the plugin.
* This allows the plugin to get more context about what it is logging.
*/
static int FiletypeInit(ConfNode *conf, bool threaded, void **data)
static int FiletypeInit(const ConfNode *conf, const bool threaded, void **data)
{
SCLogNotice("Initializing template eve output plugin: threaded=%d", threaded);
Context *context = SCCalloc(1, sizeof(Context));
@ -125,7 +125,7 @@ static void FiletypeDeinit(void *data)
* In the case of non-threaded EVE logging this function is called
* once with a thread_id of 0.
*/
static int FiletypeThreadInit(void *ctx, ThreadId thread_id, void **thread_data)
static int FiletypeThreadInit(const void *ctx, const ThreadId thread_id, void **thread_data)
{
SCLogNotice("thread_id=%d", thread_id);
ThreadData *tdata = SCCalloc(1, sizeof(ThreadData));
@ -146,7 +146,7 @@ static int FiletypeThreadInit(void *ctx, ThreadId thread_id, void **thread_data)
* This is where any cleanup per thread should be done including free'ing of the
* thread_data if needed.
*/
static void FiletypeThreadDeinit(void *ctx, void *thread_data)
static void FiletypeThreadDeinit(const void *ctx, void *thread_data)
{
SCLogNotice("thread_data=%p", thread_data);
if (thread_data == NULL) {
@ -171,9 +171,10 @@ static void FiletypeThreadDeinit(void *ctx, void *thread_data)
* to any resource that may block it might be best to enqueue the buffers for
* further processing which will require copying of the provided buffer.
*/
static int FiletypeWrite(const char *buffer, int buffer_len, void *data, void *thread_data)
static int FiletypeWrite(
const char *buffer, const int buffer_len, const void *data, void *thread_data)
{
Context *ctx = data;
const Context *ctx = data;
ThreadData *thread = thread_data;
SCLogNotice("thread_id=%d, data=%p, thread_data=%p", thread->thread_id, data, thread_data);

@ -37,24 +37,25 @@ void NullLogInitialize(void)
#define OUTPUT_NAME "nullsink"
static int NullLogInit(ConfNode *conf, bool threaded, void **init_data)
static int NullLogInit(const ConfNode *conf, const bool threaded, void **init_data)
{
*init_data = NULL;
return 0;
}
static int NullLogWrite(const char *buffer, int buffer_len, void *init_data, void *thread_data)
static int NullLogWrite(
const char *buffer, const int buffer_len, const void *init_data, void *thread_data)
{
return 0;
}
static int NullLogThreadInit(void *init_data, ThreadId thread_id, void **thread_data)
static int NullLogThreadInit(const void *init_data, const ThreadId thread_id, void **thread_data)
{
*thread_data = NULL;
return 0;
}
static void NullLogThreadDeInit(void *init_data, void *thread_data)
static void NullLogThreadDeInit(const void *init_data, void *thread_data)
{
}

@ -41,7 +41,7 @@ typedef struct Context_ {
int alert_syslog_level;
} Context;
static int SyslogInit(ConfNode *conf, bool threaded, void **init_data)
static int SyslogInit(const ConfNode *conf, const bool threaded, void **init_data)
{
Context *context = SCCalloc(1, sizeof(Context));
if (context == NULL) {
@ -79,9 +79,10 @@ static int SyslogInit(ConfNode *conf, bool threaded, void **init_data)
return 0;
}
static int SyslogWrite(const char *buffer, int buffer_len, void *init_data, void *thread_data)
static int SyslogWrite(
const char *buffer, const int buffer_len, const void *init_data, void *thread_data)
{
Context *context = init_data;
const Context *context = init_data;
syslog(context->alert_syslog_level, "%s", (const char *)buffer);
return 0;

@ -100,7 +100,7 @@ typedef struct SCEveFileType_ {
*
* \retval 0 on success, -1 on failure
*/
int (*Init)(ConfNode *conf, bool threaded, void **init_data);
int (*Init)(const ConfNode *conf, const bool threaded, void **init_data);
/**
* \brief Called for each EVE log record.
@ -119,7 +119,8 @@ typedef struct SCEveFileType_ {
*
* \retval 0 on success, -1 on failure
*/
int (*Write)(const char *buffer, int buffer_len, void *init_data, void *thread_data);
int (*Write)(
const char *buffer, const int buffer_len, const void *init_data, void *thread_data);
/**
* \brief Final call to deinitialize this filetype.
@ -150,7 +151,7 @@ typedef struct SCEveFileType_ {
*
* \retval 0 on success, -1 on failure
*/
int (*ThreadInit)(void *init_data, ThreadId thread_id, void **thread_data);
int (*ThreadInit)(const void *init_data, const ThreadId thread_id, void **thread_data);
/**
* \brief Called to deinitialize each thread.
@ -162,7 +163,7 @@ typedef struct SCEveFileType_ {
*
* \param thread_data The data setup in ThreadInit
*/
void (*ThreadDeinit)(void *init_data, void *thread_data);
void (*ThreadDeinit)(const void *init_data, void *thread_data);
/* Internal list management. */
TAILQ_ENTRY(SCEveFileType_) entries;

Loading…
Cancel
Save