suricata
alert-fastlog.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-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 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  *
23  * Logs alerts in a line based text format compatible to Snort's
24  * alert_fast format.
25  */
26 
27 #include "suricata-common.h"
28 #include "detect.h"
29 #include "flow.h"
30 #include "conf.h"
31 
32 #include "threads.h"
33 #include "tm-threads.h"
34 #include "threadvars.h"
35 #include "util-debug.h"
36 
37 #include "util-unittest.h"
38 #include "util-unittest-helper.h"
39 
40 #include "detect-parse.h"
41 #include "detect-engine.h"
42 #include "detect-engine-build.h"
43 #include "detect-engine-mpm.h"
44 #include "detect-reference.h"
46 
47 #include "output.h"
48 #include "alert-fastlog.h"
49 
50 #include "util-privs.h"
51 #include "util-print.h"
52 #include "util-proto-name.h"
53 #include "util-optimize.h"
54 #include "util-logopenfile.h"
55 #include "util-time.h"
56 
57 #include "action-globals.h"
58 
59 #define DEFAULT_LOG_FILENAME "fast.log"
60 
61 #define MODULE_NAME "AlertFastLog"
62 
63 /* The largest that size allowed for one alert string. */
64 #define MAX_FASTLOG_ALERT_SIZE 2048
65 /* The largest alert buffer that will be written at one time, possibly
66  * holding multiple alerts. */
67 #define MAX_FASTLOG_BUFFER_SIZE (2 * MAX_FASTLOG_ALERT_SIZE)
68 
69 TmEcode AlertFastLogThreadInit(ThreadVars *, const void *, void **);
71 void AlertFastLogRegisterTests(void);
72 static void AlertFastLogDeInitCtx(OutputCtx *);
73 
74 static bool AlertFastLogCondition(ThreadVars *tv, void *thread_data, const Packet *p);
75 int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p);
76 
78 {
79  OutputPacketLoggerFunctions output_logger_functions = {
81  .FlushFunc = NULL,
82  .ConditionFunc = AlertFastLogCondition,
83  .ThreadInitFunc = AlertFastLogThreadInit,
84  .ThreadDeinitFunc = AlertFastLogThreadDeinit,
85  .ThreadExitPrintStatsFunc = NULL,
86  };
87 
89  LOGGER_ALERT_FAST, MODULE_NAME, "fast", AlertFastLogInitCtx, &output_logger_functions);
91 }
92 
93 typedef struct AlertFastLogThread_ {
94  /** LogFileCtx has the pointer to the file and a mutex to allow multithreading */
97 
98 static bool AlertFastLogCondition(ThreadVars *tv, void *thread_data, const Packet *p)
99 {
100  return (p->alerts.cnt > 0);
101 }
102 
103 static inline void AlertFastLogOutputAlert(AlertFastLogThread *aft, char *buffer,
104  int alert_size)
105 {
106  /* Output the alert string and count alerts. Only need to lock here. */
107  aft->file_ctx->Write(buffer, alert_size, aft->file_ctx);
108 }
109 
110 int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p)
111 {
112  AlertFastLogThread *aft = (AlertFastLogThread *)data;
113  int i;
114  char timebuf[64];
115  int decoder_event = 0;
116 
117  CreateTimeString(p->ts, timebuf, sizeof(timebuf));
118 
119  char srcip[46], dstip[46];
120  if (PacketIsIPv4(p)) {
121  PrintInet(AF_INET, (const void *)GET_IPV4_SRC_ADDR_PTR(p), srcip, sizeof(srcip));
122  PrintInet(AF_INET, (const void *)GET_IPV4_DST_ADDR_PTR(p), dstip, sizeof(dstip));
123  } else if (PacketIsIPv6(p)) {
124  PrintInetIPv6((const void *)GET_IPV6_SRC_ADDR(p), srcip, sizeof(srcip),
125  aft->file_ctx->compress_ipv6);
126  PrintInetIPv6((const void *)GET_IPV6_DST_ADDR(p), dstip, sizeof(dstip),
127  aft->file_ctx->compress_ipv6);
128  } else {
129  decoder_event = 1;
130  }
131 
132  /* Buffer to store the generated alert strings. The buffer is
133  * filled with alert strings until it doesn't have room to store
134  * another full alert, only then is the buffer written. This is
135  * more efficient for multiple alerts and only slightly slower for
136  * single alerts.
137  */
138  char alert_buffer[MAX_FASTLOG_BUFFER_SIZE];
139 
140  char proto[16] = "";
141  const char *protoptr;
142  if (SCProtoNameValid(PacketGetIPProto(p))) {
143  protoptr = known_proto[PacketGetIPProto(p)];
144  } else {
145  snprintf(proto, sizeof(proto), "PROTO:%03" PRIu32, PacketGetIPProto(p));
146  protoptr = proto;
147  }
148  uint16_t src_port_or_icmp = p->sp;
149  uint16_t dst_port_or_icmp = p->dp;
150  if (PacketGetIPProto(p) == IPPROTO_ICMP || PacketGetIPProto(p) == IPPROTO_ICMPV6) {
151  src_port_or_icmp = p->icmp_s.type;
152  dst_port_or_icmp = p->icmp_s.code;
153  }
154  for (i = 0; i < p->alerts.cnt; i++) {
155  const PacketAlert *pa = &p->alerts.alerts[i];
156  if (unlikely(pa->s == NULL || (pa->action & ACTION_ALERT) == 0)) {
157  continue;
158  }
159 
160  const char *action = "";
161  if ((pa->action & ACTION_DROP) && EngineModeIsIPS()) {
162  action = "[Drop] ";
163  } else if (pa->action & ACTION_DROP) {
164  action = "[wDrop] ";
165  }
166 
167  /* Create the alert string without locking. */
168  int size = 0;
169  if (likely(decoder_event == 0)) {
170  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
171  "%s %s[**] [%" PRIu32 ":%" PRIu32 ":%"
172  PRIu32 "] %s [**] [Classification: %s] [Priority: %"PRIu32"]"
173  " {%s} %s:%" PRIu32 " -> %s:%" PRIu32 "\n", timebuf, action,
174  pa->s->gid, pa->s->id, pa->s->rev, pa->s->msg, pa->s->class_msg, pa->s->prio,
175  protoptr, srcip, src_port_or_icmp, dstip, dst_port_or_icmp);
176  } else {
177  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
178  "%s %s[**] [%" PRIu32 ":%" PRIu32
179  ":%" PRIu32 "] %s [**] [Classification: %s] [Priority: "
180  "%" PRIu32 "] [**] [Raw pkt: ", timebuf, action, pa->s->gid,
181  pa->s->id, pa->s->rev, pa->s->msg, pa->s->class_msg, pa->s->prio);
182  PrintBufferRawLineHex(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
183  GET_PKT_DATA(p), GET_PKT_LEN(p) < 32 ? GET_PKT_LEN(p) : 32);
184  uint64_t pcap_cnt = PcapPacketCntGet(p);
185  if (pcap_cnt != 0) {
186  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE,
187  "] [pcap file packet: %" PRIu64 "]\n", pcap_cnt);
188  } else {
189  PrintBufferData(alert_buffer, &size, MAX_FASTLOG_ALERT_SIZE, "]\n");
190  }
191  }
192 
193  /* Write the alert to output file */
194  AlertFastLogOutputAlert(aft, alert_buffer, size);
195  }
196 
197  return TM_ECODE_OK;
198 }
199 
200 TmEcode AlertFastLogThreadInit(ThreadVars *t, const void *initdata, void **data)
201 {
203  if (unlikely(aft == NULL))
204  return TM_ECODE_FAILED;
205  if(initdata == NULL)
206  {
207  SCLogDebug("Error getting context for AlertFastLog. \"initdata\" argument NULL");
208  SCFree(aft);
209  return TM_ECODE_FAILED;
210  }
211  /** Use the Output Context (file pointer and mutex) */
212  aft->file_ctx = ((OutputCtx *)initdata)->data;
213 
214  *data = (void *)aft;
215  return TM_ECODE_OK;
216 }
217 
219 {
220  AlertFastLogThread *aft = (AlertFastLogThread *)data;
221  if (aft == NULL) {
222  return TM_ECODE_OK;
223  }
224 
225  /* clear memory */
226  memset(aft, 0, sizeof(AlertFastLogThread));
227 
228  SCFree(aft);
229  return TM_ECODE_OK;
230 }
231 
232 /**
233  * \brief Create a new LogFileCtx for "fast" output style.
234  * \param conf The configuration node for this output.
235  * \return A LogFileCtx pointer on success, NULL on failure.
236  */
238 {
239  OutputInitResult result = { NULL, false };
240  LogFileCtx *logfile_ctx = LogFileNewCtx();
241  if (logfile_ctx == NULL) {
242  SCLogDebug("AlertFastLogInitCtx2: Could not create new LogFileCtx");
243  return result;
244  }
245 
246  if (SCConfLogOpenGeneric(conf, logfile_ctx, DEFAULT_LOG_FILENAME, 1) < 0) {
247  LogFileFreeCtx(logfile_ctx);
248  return result;
249  }
250 
251  OutputCtx *output_ctx = SCCalloc(1, sizeof(OutputCtx));
252  if (unlikely(output_ctx == NULL)) {
253  LogFileFreeCtx(logfile_ctx);
254  return result;
255  }
256 
257  output_ctx->data = logfile_ctx;
258  output_ctx->DeInit = AlertFastLogDeInitCtx;
259 
260  result.ctx = output_ctx;
261  result.ok = true;
262  return result;
263 }
264 
265 static void AlertFastLogDeInitCtx(OutputCtx *output_ctx)
266 {
267  LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data;
268  LogFileFreeCtx(logfile_ctx);
269  SCFree(output_ctx);
270 }
271 
272 /*------------------------------Unittests-------------------------------------*/
273 
274 #ifdef UNITTESTS
275 
276 static int AlertFastLogTest01(void)
277 {
278  uint8_t *buf = (uint8_t *) "GET /one/ HTTP/1.1\r\n"
279  "Host: one.example.org\r\n";
280 
281  uint16_t buflen = strlen((char *)buf);
282  Packet *p = NULL;
283  ThreadVars th_v;
284  memset(&th_v, 0, sizeof(th_v));
285  StatsThreadInit(&th_v.stats);
286 
287  p = UTHBuildPacket(buf, buflen, IPPROTO_TCP);
288 
290  FAIL_IF(de_ctx == NULL);
291  de_ctx->flags |= DE_QUIET;
292 
296 
297  de_ctx->sig_list = SigInit(de_ctx, "alert tcp any any -> any any "
298  "(msg:\"FastLog test\"; content:\"GET\"; "
299  "Classtype:unknown; sid:1;)");
300 
302  DetectEngineThreadCtx *det_ctx;
303  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
304 
305  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
306  FAIL_IF_NOT(p->alerts.cnt == 1);
307  FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0);
308 
309  UTHFreePackets(&p, 1);
310  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
312  StatsThreadCleanup(&th_v.stats);
313  PASS;
314 }
315 
316 static int AlertFastLogTest02(void)
317 {
318  uint8_t *buf = (uint8_t *) "GET /one/ HTTP/1.1\r\n"
319  "Host: one.example.org\r\n";
320  uint16_t buflen = strlen((char *)buf);
321  Packet *p = NULL;
322  ThreadVars th_v;
323 
324  memset(&th_v, 0, sizeof(th_v));
325  StatsThreadInit(&th_v.stats);
326 
327  p = UTHBuildPacket(buf, buflen, IPPROTO_TCP);
328 
330  FAIL_IF(de_ctx == NULL);
331  de_ctx->flags |= DE_QUIET;
332 
336 
337  de_ctx->sig_list = SigInit(de_ctx, "alert tcp any any -> any any "
338  "(msg:\"FastLog test\"; content:\"GET\"; "
339  "Classtype:unknown; sid:1;)");
340 
342  DetectEngineThreadCtx *det_ctx;
343  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
344 
345  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
346  FAIL_IF_NOT(p->alerts.cnt == 1);
347  FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0);
348 
349  UTHFreePackets(&p, 1);
350  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
352  StatsThreadCleanup(&th_v.stats);
353  PASS;
354 }
355 
356 #endif /* UNITTESTS */
357 
358 /**
359  * \brief This function registers unit tests for AlertFastLog API.
360  */
362 {
363 #ifdef UNITTESTS
364  UtRegisterTest("AlertFastLogTest01", AlertFastLogTest01);
365  UtRegisterTest("AlertFastLogTest02", AlertFastLogTest02);
366 #endif /* UNITTESTS */
367 }
tm-threads.h
AlertFastLogThread_
Definition: alert-fastlog.c:93
AlertFastLogger
int AlertFastLogger(ThreadVars *tv, void *data, const Packet *p)
Definition: alert-fastlog.c:110
detect-engine.h
AlertFastLogRegisterTests
void AlertFastLogRegisterTests(void)
This function registers unit tests for AlertFastLog API.
Definition: alert-fastlog.c:361
PacketAlert_::s
const struct Signature_ * s
Definition: decode.h:253
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition: util-unittest.c:103
LogFileNewCtx
LogFileCtx * LogFileNewCtx(void)
LogFileNewCtx() Get a new LogFileCtx.
Definition: util-logopenfile.c:712
PcapPacketCntGet
uint64_t PcapPacketCntGet(const Packet *p)
Definition: decode.c:1107
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
PacketAlerts_::cnt
uint16_t cnt
Definition: decode.h:288
action-globals.h
threads.h
PrintInetIPv6
const char * PrintInetIPv6(const void *src, char *dst, socklen_t size, bool compress_ipv6)
Definition: util-print.c:209
AlertFastLogRegister
void AlertFastLogRegister(void)
Definition: alert-fastlog.c:77
LogFileCtx_
Definition: util-logopenfile.h:72
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:933
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2684
PacketAlerts_::alerts
PacketAlert * alerts
Definition: decode.h:291
SCProtoNameValid
bool SCProtoNameValid(uint16_t proto)
Function to check if the received protocol number is valid and do we have corresponding name entry fo...
Definition: util-proto-name.c:450
DE_QUIET
#define DE_QUIET
Definition: detect.h:329
util-privs.h
LogFileCtx_::Write
int(* Write)(const char *buffer, int buffer_len, struct LogFileCtx_ *fp)
Definition: util-logopenfile.h:87
known_proto
const char * known_proto[256]
Definition: util-proto-name.c:40
UTHBuildPacket
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
Definition: util-unittest-helper.c:365
SigMatchSignatures
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:2417
proto
uint8_t proto
Definition: decode-template.h:0
TM_ECODE_FAILED
@ TM_ECODE_FAILED
Definition: tm-threads-common.h:82
AlertFastLogThreadInit
TmEcode AlertFastLogThreadInit(ThreadVars *, const void *, void **)
Definition: alert-fastlog.c:200
MAX_FASTLOG_BUFFER_SIZE
#define MAX_FASTLOG_BUFFER_SIZE
Definition: alert-fastlog.c:67
GET_IPV6_DST_ADDR
#define GET_IPV6_DST_ADDR(p)
Definition: decode.h:205
Packet_::alerts
PacketAlerts alerts
Definition: decode.h:624
util-unittest.h
DEFAULT_LOG_FILENAME
#define DEFAULT_LOG_FILENAME
Definition: alert-fastlog.c:59
util-unittest-helper.h
FAIL_IF_NOT
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
Definition: util-unittest.h:82
OutputCtx_::data
void * data
Definition: tm-modules.h:91
AlertFastLogThread_::file_ctx
LogFileCtx * file_ctx
Definition: alert-fastlog.c:95
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
OutputCtx_
Definition: tm-modules.h:88
PacketAlert_::action
uint8_t action
Definition: decode.h:251
detect-reference.h
Packet_::icmp_s
struct Packet_::@32::@39 icmp_s
Signature_::gid
uint32_t gid
Definition: detect.h:714
util-debug.h
PASS
#define PASS
Pass the test.
Definition: util-unittest.h:105
GET_IPV4_DST_ADDR_PTR
#define GET_IPV4_DST_ADDR_PTR(p)
Definition: decode.h:200
PrintBufferRawLineHex
void PrintBufferRawLineHex(char *nbuf, int *offset, int max_size, const uint8_t *buf, uint32_t buflen)
print a buffer as hex on a single line
Definition: util-print.c:44
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:19
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:47
DetectEngineThreadCtx_
Definition: detect.h:1245
Packet_::ts
SCTime_t ts
Definition: decode.h:559
util-print.h
GET_PKT_DATA
#define GET_PKT_DATA(p)
Definition: decode.h:210
detect-engine-mpm.h
AlertFastLogInitCtx
OutputInitResult AlertFastLogInitCtx(SCConfNode *conf)
Create a new LogFileCtx for "fast" output style.
Definition: alert-fastlog.c:237
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
PrintInet
const char * PrintInet(int af, const void *src, char *dst, socklen_t size)
Definition: util-print.c:238
DetectEngineThreadCtxInit
TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
initialize thread specific detection engine context
Definition: detect-engine.c:3418
Packet_::sp
Port sp
Definition: decode.h:512
util-time.h
OutputInitResult_::ok
bool ok
Definition: output.h:48
SigInit
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
Definition: detect-parse.c:3105
ACTION_ALERT
#define ACTION_ALERT
Definition: action-globals.h:29
Packet_
Definition: decode.h:505
detect-engine-build.h
GET_PKT_LEN
#define GET_PKT_LEN(p)
Definition: decode.h:209
conf.h
TmEcode
TmEcode
Definition: tm-threads-common.h:80
util-proto-name.h
LogFileCtx_::compress_ipv6
bool compress_ipv6
Definition: util-logopenfile.h:150
SigGroupBuild
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Definition: detect-engine-build.c:2207
StatsThreadInit
void StatsThreadInit(StatsThreadContext *stats)
Definition: counters.c:1331
alert-fastlog.h
Signature_::class_msg
char * class_msg
Definition: detect.h:739
MAX_FASTLOG_ALERT_SIZE
#define MAX_FASTLOG_ALERT_SIZE
Definition: alert-fastlog.c:64
OutputInitResult_
Definition: output.h:46
FAIL_IF
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
Definition: util-unittest.h:71
GET_IPV4_SRC_ADDR_PTR
#define GET_IPV4_SRC_ADDR_PTR(p)
Definition: decode.h:199
PrintBufferData
#define PrintBufferData(buf, buf_offset_ptr, buf_size,...)
Definition: util-print.h:27
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:94
ACTION_DROP
#define ACTION_DROP
Definition: action-globals.h:30
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
Definition: detect-engine.c:3657
OutputPacketLoggerFunctions_::LogFunc
PacketLogger LogFunc
Definition: output.h:88
OutputRegisterPacketModule
void OutputRegisterPacketModule(LoggerId id, const char *name, const char *conf_name, OutputInitFunc InitFunc, OutputPacketLoggerFunctions *output_module_functions)
Register a packet output module.
Definition: output.c:195
Signature_::rev
uint32_t rev
Definition: detect.h:715
LogFileFreeCtx
int LogFileFreeCtx(LogFileCtx *lf_ctx)
LogFileFreeCtx() Destroy a LogFileCtx (Close the file and free memory)
Definition: util-logopenfile.c:926
util-classification-config.h
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:942
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:33
Signature_::prio
int prio
Definition: detect.h:716
util-optimize.h
threadvars.h
AlertFastLogThread
struct AlertFastLogThread_ AlertFastLogThread
SCConfLogOpenGeneric
int SCConfLogOpenGeneric(SCConfNode *conf, LogFileCtx *log_ctx, const char *default_filename, int rotate)
open a generic output "log file", which may be a regular file or a socket
Definition: util-logopenfile.c:480
GET_IPV6_SRC_ADDR
#define GET_IPV6_SRC_ADDR(p)
Definition: decode.h:204
SCFree
#define SCFree(p)
Definition: util-mem.h:61
util-logopenfile.h
Signature_::id
uint32_t id
Definition: detect.h:713
detect-parse.h
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2645
MODULE_NAME
#define MODULE_NAME
Definition: alert-fastlog.c:61
EngineModeIsIPS
int EngineModeIsIPS(void)
Definition: suricata.c:246
SCClassConfGenerateValidDummyClassConfigFD01
FILE * SCClassConfGenerateValidDummyClassConfigFD01(void)
Creates a dummy classification file, with all valid Classtypes, for testing purposes.
Definition: util-classification-config.c:586
PacketAlert_
Definition: decode.h:249
likely
#define likely(expr)
Definition: util-optimize.h:32
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:935
Signature_::msg
char * msg
Definition: detect.h:736
flow.h
Packet_::dp
Port dp
Definition: decode.h:520
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
ThreadVars_::stats
StatsThreadContext stats
Definition: threadvars.h:121
SCConfNode_
Definition: conf.h:37
StatsThreadCleanup
void StatsThreadCleanup(StatsThreadContext *stats)
Definition: counters.c:1427
OutputPacketLoggerFunctions_
Definition: output.h:87
LOGGER_ALERT_FAST
@ LOGGER_ALERT_FAST
Definition: suricata-common.h:495
SCClassConfLoadClassificationConfigFile
bool SCClassConfLoadClassificationConfigFile(DetectEngineCtx *de_ctx, FILE *fd)
Loads the Classtype info from the classification.config file.
Definition: util-classification-config.c:519
AlertFastLogThreadDeinit
TmEcode AlertFastLogThreadDeinit(ThreadVars *, void *)
Definition: alert-fastlog.c:218
CreateTimeString
void CreateTimeString(const SCTime_t ts, char *str, size_t size)
Definition: util-time.c:272
output.h
SCClassConfDeInitContext
void SCClassConfDeInitContext(DetectEngineCtx *de_ctx)
Releases resources used by the Classification Config API.
Definition: util-classification-config.c:190
UTHFreePackets
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
Definition: util-unittest-helper.c:456