suricata
plugin.c
Go to the documentation of this file.
1/* Copyright (C) 2024 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#include "suricata-plugin.h"
19#include "suricata-common.h"
20#include "util-debug.h"
21
22#include "runmode.h"
23#include "source.h"
24
25static void InitCapturePlugin(const char *args, int plugin_slot, int receive_slot, int decode_slot)
26{
27 SCLogNotice("...");
28 CiCaptureIdsRegister(plugin_slot);
31}
32
33static void SCPluginInit(void)
34{
35 SCLogNotice("...");
36 SCCapturePlugin *plugin = SCCalloc(1, sizeof(SCCapturePlugin));
37 if (plugin == NULL) {
38 FatalError("Failed to allocate memory for capture plugin");
39 }
40 plugin->name = "ci-capture";
41 plugin->Init = InitCapturePlugin;
44}
45
47 .version = SC_API_VERSION,
48 .suricata_version = SC_PACKAGE_VERSION,
49 .name = "ci-capture",
50 .plugin_version = "0.1.0",
51 .author = "OISF Developer",
52 .license = "GPL-2.0-only",
53 .Init = SCPluginInit,
54};
55
57{
58 return &PluginRegistration;
59}
const SCPlugin * SCPluginRegister()
Definition plugin.c:56
const SCPlugin PluginRegistration
Definition plugin.c:46
const char * CiCaptureIdsGetDefaultRunMode(void)
Definition runmode.c:25
void CiCaptureIdsRegister(int slot)
Definition runmode.c:70
void TmModuleDecodeCiCaptureRegister(int slot)
Definition source.c:146
void TmModuleReceiveCiCaptureRegister(int slot)
Definition source.c:133
void(* Init)(const char *args, int plugin_slot, int receive_slot, int decode_slot)
const char *(* GetDefaultMode)(void)
uint64_t version
#define SC_PACKAGE_VERSION
int SCPluginRegisterCapture(SCCapturePlugin *)
#define FatalError(...)
Definition util-debug.h:510
#define SCLogNotice(...)
Macro used to log NOTICE messages.
Definition util-debug.h:243
#define SCCalloc(nm, sz)
Definition util-mem.h:53