suricata
suricata-plugin.h
Go to the documentation of this file.
1/* Copyright (C) 2020-2021 Open Information Security Foundation
2 *
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
5 * Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#ifndef SURICATA_SURICATA_PLUGIN_H
19#define SURICATA_SURICATA_PLUGIN_H
20
21#include <stdint.h>
22#include <stdbool.h>
23
24#include "queue.h"
25#include "autoconf.h"
26
27/**
28 * The size of the data chunk inside each packet structure a plugin
29 * has for private data (Packet->plugin_v).
30 */
31#define PLUGIN_VAR_SIZE 64
32
33// Do not reuse autoconf PACKAGE_VERSION which is a string
34// Defined as major version.minor version (no patch version)
35static const uint64_t SC_API_VERSION = 0x0800;
36#define SC_PACKAGE_VERSION PACKAGE_VERSION
37
38/**
39 * Structure to define a Suricata plugin.
40 */
41typedef struct SCPlugin_ {
42 // versioning to check suricata/plugin API compatibility
43 uint64_t version;
44 const char *suricata_version;
45 const char *name;
46 const char *plugin_version;
47 const char *license;
48 const char *author;
49 void (*Init)(void);
51
52typedef SCPlugin *(*SCPluginRegisterFunc)(void);
53
54typedef struct SCCapturePlugin_ {
55 char *name;
56 void (*Init)(const char *args, int plugin_slot, int receive_slot, int decode_slot);
57 int (*ThreadInit)(void *ctx, int thread_id, void **thread_ctx);
58 int (*ThreadDeinit)(void *ctx, void *thread_ctx);
59 const char *(*GetDefaultMode)(void);
62
64
65typedef struct SCAppLayerPlugin_ {
66 const char *name;
67 void (*Register)(void);
68 void (*KeywordsRegister)(void);
69 const char *logname;
70 const char *confname;
71 uint8_t dir;
72 bool (*Logger)(const void *tx, void *jb);
74
76
77#endif /* __SURICATA_PLUGIN_H */
struct Thresholds ctx
void(* KeywordsRegister)(void)
const char * logname
bool(* Logger)(const void *tx, void *jb)
void(* Register)(void)
const char * confname
TAILQ_ENTRY(SCCapturePlugin_) entries
void(* Init)(const char *args, int plugin_slot, int receive_slot, int decode_slot)
int(* ThreadDeinit)(void *ctx, void *thread_ctx)
int(* ThreadInit)(void *ctx, int thread_id, void **thread_ctx)
void(* Init)(void)
uint64_t version
const char * suricata_version
const char * plugin_version
const char * license
const char * author
const char * name
struct SCAppLayerPlugin_ SCAppLayerPlugin
struct SCPlugin_ SCPlugin
struct SCCapturePlugin_ SCCapturePlugin
int SCPluginRegisterAppLayer(SCAppLayerPlugin *)
int SCPluginRegisterCapture(SCCapturePlugin *)