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 
25 static void InitCapturePlugin(const char *args, int plugin_slot, int receive_slot, int decode_slot)
26 {
27  SCLogNotice("...");
28  CiCaptureIdsRegister(plugin_slot);
31 }
32 
33 static 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  .name = "ci-capture",
48  .author = "OISF Developer",
49  .license = "GPL-2.0-only",
50  .Init = SCPluginInit,
51 };
52 
54 {
55  return &PluginRegistration;
56 }
suricata-plugin.h
SCPluginRegisterCapture
int SCPluginRegisterCapture(SCCapturePlugin *)
SCCapturePlugin_::Init
void(* Init)(const char *args, int plugin_slot, int receive_slot, int decode_slot)
Definition: suricata-plugin.h:46
SCCapturePlugin_::GetDefaultMode
const char *(* GetDefaultMode)(void)
Definition: suricata-plugin.h:49
SCPluginRegister
const SCPlugin * SCPluginRegister()
Definition: plugin.c:53
source.h
util-debug.h
CiCaptureIdsRegister
void CiCaptureIdsRegister(int slot)
Definition: runmode.c:70
SCCapturePlugin_::name
char * name
Definition: suricata-plugin.h:45
SCCapturePlugin_
Definition: suricata-plugin.h:44
TmModuleDecodeCiCaptureRegister
void TmModuleDecodeCiCaptureRegister(int slot)
Definition: source.c:145
TmModuleReceiveCiCaptureRegister
void TmModuleReceiveCiCaptureRegister(int slot)
Definition: source.c:132
SCPlugin_
Definition: suricata-plugin.h:35
CiCaptureIdsGetDefaultRunMode
const char * CiCaptureIdsGetDefaultRunMode(void)
Definition: runmode.c:25
suricata-common.h
FatalError
#define FatalError(...)
Definition: util-debug.h:502
PluginRegistration
const SCPlugin PluginRegistration
Definition: plugin.c:46
SCPlugin_::name
const char * name
Definition: suricata-plugin.h:36
runmode.h
SCLogNotice
#define SCLogNotice(...)
Macro used to log NOTICE messages.
Definition: util-debug.h:237
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53