* 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));
* 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));
* 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) {
* 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);
#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)
{
}
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) {
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;
*
* \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.
*
* \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.
*
* \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.
*
* \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;