suricata
detect-dnp3.c
Go to the documentation of this file.
1 /* Copyright (C) 2015-2022 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-common.h"
19 
20 #include "stream.h"
21 
22 #include "detect.h"
23 #include "detect-parse.h"
24 #include "detect-dnp3.h"
25 #include "detect-engine.h"
26 #include "detect-engine-buffer.h"
27 #include "detect-engine-mpm.h"
30 #include "detect-engine-uint.h"
31 
32 #include "app-layer-dnp3.h"
33 #include "util-byte.h"
34 
35 static int g_dnp3_match_buffer_id = 0;
36 static int g_dnp3_data_buffer_id = 0;
37 static int g_dnp3_ind_buffer_id = 0;
38 
39 /**
40  * The detection struct.
41  */
42 typedef struct DetectDNP3_ {
43  /* Object info for object detection. */
44  uint8_t obj_group;
45  uint8_t obj_variation;
47 
48 #ifdef UNITTESTS
49 static void DetectDNP3FuncRegisterTests(void);
50 static void DetectDNP3ObjRegisterTests(void);
51 #endif
52 
53 static InspectionBuffer *GetDNP3Data(DetectEngineThreadCtx *det_ctx,
54  const DetectEngineTransforms *transforms,
55  Flow *_f, const uint8_t flow_flags,
56  void *txv, const int list_id)
57 {
58  SCLogDebug("list_id %d", list_id);
59  InspectionBuffer *buffer = InspectionBufferGet(det_ctx, list_id);
60  if (buffer->inspect == NULL) {
61  DNP3Transaction *tx = (DNP3Transaction *)txv;
62  SCLogDebug("tx %p", tx);
63 
64  if ((flow_flags & STREAM_TOSERVER && !tx->is_request) ||
65  (flow_flags & STREAM_TOCLIENT && tx->is_request)) {
66  return NULL;
67  }
68 
69  if (tx->buffer == NULL || tx->buffer_len == 0) {
70  return NULL;
71  }
72 
73  SCLogDebug("tx %p data %p data_len %u", tx, tx->buffer, tx->buffer_len);
75  det_ctx, list_id, buffer, tx->buffer, tx->buffer_len, transforms);
76  }
77  return buffer;
78 }
79 
80 static void DetectDNP3FuncFree(DetectEngineCtx *de_ctx, void *ptr)
81 {
82  SCDetectU8Free(ptr);
83 }
84 
85 static int DetectDNP3FuncSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
86 {
87  SCEnter();
88 
90  return -1;
91 
92  DetectU8Data *detect = SCDnp3DetectFuncParse(str);
93  if (detect == NULL) {
94  SCLogError("Invalid argument \"%s\" supplied to dnp3_func keyword.", str);
95  return -1;
96  }
97 
99  g_dnp3_match_buffer_id) == NULL) {
100  goto error;
101  }
102 
103  SCReturnInt(0);
104 error:
105  if (detect != NULL) {
106  DetectDNP3FuncFree(NULL, detect);
107  }
108  SCReturnInt(-1);
109 }
110 
111 static void DetectDNP3IndFree(DetectEngineCtx *de_ctx, void *ptr)
112 {
113  SCDetectU16Free(ptr);
114 }
115 
116 static int DetectDNP3IndSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
117 {
118  SCEnter();
119 
121  return -1;
122 
123  DetectU16Data *detect = SCDnp3DetectIndParse(str);
124  if (detect == NULL) {
125  SCLogError("Invalid argument \"%s\" supplied to dnp3.ind keyword.", str);
126  return -1;
127  }
128 
130  de_ctx, s, DETECT_DNP3IND, (SigMatchCtx *)detect, g_dnp3_ind_buffer_id) == NULL) {
131  goto error;
132  }
133 
134  SCReturnInt(0);
135 error:
136  if (detect != NULL) {
137  DetectDNP3IndFree(NULL, detect);
138  }
139  SCReturnInt(-1);
140 }
141 
142 /**
143  * \brief Parse the value of string of the dnp3_obj keyword.
144  *
145  * \param str the input string
146  * \param gout pointer to variable to store the parsed group integer
147  * \param vout pointer to variable to store the parsed variation integer
148  *
149  * \retval 1 if parsing successful otherwise 0.
150  */
151 static int DetectDNP3ObjParse(const char *str, uint8_t *group, uint8_t *var)
152 {
153  size_t size = strlen(str) + 1;
154  char groupstr[size], *varstr, *sep;
155  strlcpy(groupstr, str, size);
156 
157  sep = strchr(groupstr, ',');
158  if (sep == NULL) {
159  return 0;
160  }
161  *sep = '\0';
162  varstr = sep + 1;
163 
164  if (StringParseUint8(group, 0, (uint16_t)strlen(groupstr), groupstr) <= 0) {
165  return 0;
166  }
167 
168  if (StringParseUint8(var, 0, (uint16_t)strlen(varstr), varstr) <= 0) {
169  return 0;
170  }
171 
172  return 1;
173 }
174 
175 static int DetectDNP3ObjSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
176 {
177  SCEnter();
178  uint8_t group;
179  uint8_t variation;
180  DetectDNP3 *detect = NULL;
181 
183  return -1;
184 
185  if (!DetectDNP3ObjParse(str, &group, &variation)) {
186  goto fail;
187  }
188 
189  detect = SCCalloc(1, sizeof(*detect));
190  if (unlikely(detect == NULL)) {
191  goto fail;
192  }
193  detect->obj_group = group;
194  detect->obj_variation = variation;
195 
197  de_ctx, s, DETECT_DNP3OBJ, (SigMatchCtx *)detect, g_dnp3_match_buffer_id) == NULL) {
198  goto fail;
199  }
200 
201  SCReturnInt(1);
202 fail:
203  if (detect != NULL) {
204  SCFree(detect);
205  }
206  SCReturnInt(0);
207 }
208 
209 static void DetectDNP3Free(DetectEngineCtx *de_ctx, void *ptr)
210 {
211  SCEnter();
212  if (ptr != NULL) {
213  SCFree(ptr);
214  }
215  SCReturn;
216 }
217 
218 static int DetectDNP3FuncMatch(DetectEngineThreadCtx *det_ctx,
219  Flow *f, uint8_t flags, void *state, void *txv, const Signature *s,
220  const SigMatchCtx *ctx)
221 {
222  DNP3Transaction *tx = (DNP3Transaction *)txv;
223  DetectU8Data *detect = (DetectU8Data *)ctx;
224 
225  if (flags & STREAM_TOSERVER && tx->is_request) {
226  return DetectU8Match(tx->ah.function_code, detect);
227  } else if (flags & STREAM_TOCLIENT && !tx->is_request) {
228  return DetectU8Match(tx->ah.function_code, detect);
229  }
230 
231  return 0;
232 }
233 
234 static int DetectDNP3ObjMatch(DetectEngineThreadCtx *det_ctx,
235  Flow *f, uint8_t flags, void *state, void *txv, const Signature *s,
236  const SigMatchCtx *ctx)
237 {
238  DNP3Transaction *tx = (DNP3Transaction *)txv;
239  DetectDNP3 *detect = (DetectDNP3 *)ctx;
240  DNP3ObjectList *objects = NULL;
241 
242  if (flags & STREAM_TOSERVER && tx->is_request) {
243  objects = &tx->objects;
244  } else if (flags & STREAM_TOCLIENT && !tx->is_request) {
245  objects = &tx->objects;
246  }
247 
248  if (objects != NULL) {
249  DNP3Object *object;
250  TAILQ_FOREACH(object, objects, next) {
251  if (object->group == detect->obj_group &&
252  object->variation == detect->obj_variation) {
253  return 1;
254  }
255  }
256  }
257 
258  return 0;
259 }
260 
261 static int DetectDNP3IndMatch(DetectEngineThreadCtx *det_ctx,
262  Flow *f, uint8_t flags, void *state, void *txv, const Signature *s,
263  const SigMatchCtx *ctx)
264 {
265  DNP3Transaction *tx = (DNP3Transaction *)txv;
266  DetectU16Data *detect = (DetectU16Data *)ctx;
267 
268  return DetectU16Match((uint16_t)((tx->iin.iin1 << 8) | tx->iin.iin2), detect);
269 }
270 
271 static void DetectDNP3FuncRegister(void)
272 {
273  SCEnter();
274 
275  sigmatch_table[DETECT_DNP3FUNC].name = "dnp3_func";
276  sigmatch_table[DETECT_DNP3FUNC].alias = "dnp3.func";
278  "match on the application function code found in DNP3 request and responses";
279  sigmatch_table[DETECT_DNP3FUNC].url = "/rules/dnp3-keywords.html#dnp3-func";
281  sigmatch_table[DETECT_DNP3FUNC].AppLayerTxMatch = DetectDNP3FuncMatch;
282  sigmatch_table[DETECT_DNP3FUNC].Setup = DetectDNP3FuncSetup;
283  sigmatch_table[DETECT_DNP3FUNC].Free = DetectDNP3FuncFree;
285 #ifdef UNITTESTS
286  sigmatch_table[DETECT_DNP3FUNC].RegisterTests = DetectDNP3FuncRegisterTests;
287 #endif
288  SCReturn;
289 }
290 
291 static void DetectDNP3IndRegister(void)
292 {
293  SCEnter();
294 
295  sigmatch_table[DETECT_DNP3IND].name = "dnp3_ind";
296  sigmatch_table[DETECT_DNP3IND].alias = "dnp3.ind";
298  "match on the DNP3 internal indicator flags in the response application header";
299  sigmatch_table[DETECT_DNP3IND].url = "/rules/dnp3-keywords.html#dnp3-ind";
301  sigmatch_table[DETECT_DNP3IND].AppLayerTxMatch = DetectDNP3IndMatch;
302  sigmatch_table[DETECT_DNP3IND].Setup = DetectDNP3IndSetup;
303  sigmatch_table[DETECT_DNP3IND].Free = DetectDNP3IndFree;
305  SCReturn;
306 }
307 
308 static void DetectDNP3ObjRegister(void)
309 {
310  SCEnter();
311 
312  sigmatch_table[DETECT_DNP3OBJ].name = "dnp3_obj";
313  sigmatch_table[DETECT_DNP3OBJ].alias = "dnp3.obj";
314  sigmatch_table[DETECT_DNP3OBJ].desc = "match on the DNP3 application data objects";
315  sigmatch_table[DETECT_DNP3OBJ].url = "/rules/dnp3-keywords.html#dnp3-obj";
317  sigmatch_table[DETECT_DNP3OBJ].AppLayerTxMatch = DetectDNP3ObjMatch;
318  sigmatch_table[DETECT_DNP3OBJ].Setup = DetectDNP3ObjSetup;
319  sigmatch_table[DETECT_DNP3OBJ].Free = DetectDNP3Free;
320 #ifdef UNITTESTS
321  sigmatch_table[DETECT_DNP3OBJ].RegisterTests = DetectDNP3ObjRegisterTests;
322 #endif
323  SCReturn;
324 }
325 
326 static int DetectDNP3DataSetup(DetectEngineCtx *de_ctx, Signature *s, const char *str)
327 {
328  SCEnter();
330  return -1;
331 
332  if (SCDetectBufferSetActiveList(de_ctx, s, g_dnp3_data_buffer_id) != 0)
333  return -1;
334 
335  SCReturnInt(0);
336 }
337 
338 static void DetectDNP3DataRegister(void)
339 {
340  SCEnter();
341 
342  sigmatch_table[DETECT_DNP3DATA].name = "dnp3.data";
343  sigmatch_table[DETECT_DNP3DATA].alias = "dnp3_data";
345  "make the following content options to match on the re-assembled application buffer";
346  sigmatch_table[DETECT_DNP3DATA].url = "/rules/dnp3-keywords.html#dnp3-data";
347  sigmatch_table[DETECT_DNP3DATA].Setup = DetectDNP3DataSetup;
349 
351  DetectEngineInspectBufferGeneric, GetDNP3Data);
353  GetDNP3Data, ALPROTO_DNP3, 0);
354 
356  DetectEngineInspectBufferGeneric, GetDNP3Data);
358  GetDNP3Data, ALPROTO_DNP3, 0);
359 
360  g_dnp3_data_buffer_id = DetectBufferTypeGetByName("dnp3_data");
361  SCReturn;
362 }
363 
365 {
366  DetectDNP3DataRegister();
367 
368  DetectDNP3FuncRegister();
369  DetectDNP3IndRegister();
370  DetectDNP3ObjRegister();
371 
372  /* Register the list of func, ind and obj. */
377 
378  g_dnp3_match_buffer_id = DetectBufferTypeRegister("dnp3");
379 
382  g_dnp3_ind_buffer_id = DetectBufferTypeRegister("dnp3_ind");
383 }
384 
385 #ifdef UNITTESTS
386 
387 #include "util-unittest.h"
388 #include "util-unittest-helper.h"
389 #include "app-layer-parser.h"
390 #include "flow-util.h"
391 #include "stream-tcp.h"
392 
393 static int DetectDNP3FuncTest01(void)
394 {
397 
398  Signature *s = DetectEngineAppendSig(de_ctx, "alert dnp3 any any -> any any "
399  "(msg:\"SURICATA DNP3 Write request\"; "
400  "dnp3_func:2; sid:5000009; rev:1;)");
402 
403  SigMatch *sm = DetectBufferGetFirstSigMatch(s, g_dnp3_match_buffer_id);
404  FAIL_IF_NULL(sm);
405  FAIL_IF_NULL(sm->ctx);
406 
407  DetectU8Data *dnp3func = (DetectU8Data *)sm->ctx;
408  FAIL_IF(dnp3func->arg1 != 2);
409 
411  PASS;
412 }
413 
414 static int DetectDNP3ObjSetupTest(void)
415 {
417  FAIL_IF(de_ctx == NULL);
418 
419  Signature *s = DetectEngineAppendSig(de_ctx, "alert dnp3 any any -> any any "
420  "(msg:\"SURICATA DNP3 Object Test\"; "
421  "dnp3_obj:99,99; sid:1; rev:1;)");
422  FAIL_IF(de_ctx->sig_list == NULL);
423 
424  SigMatch *sm = DetectBufferGetFirstSigMatch(s, g_dnp3_match_buffer_id);
425  FAIL_IF_NULL(sm);
426  FAIL_IF_NULL(sm->ctx);
427 
428  DetectDNP3 *detect = (DetectDNP3 *)sm->ctx;
429  FAIL_IF(detect->obj_group != 99);
430  FAIL_IF(detect->obj_variation != 99);
431 
433  PASS;
434 }
435 
436 static int DetectDNP3ObjParseTest(void)
437 {
438  uint8_t group, var;
439 
440  FAIL_IF(!DetectDNP3ObjParse("0,0", &group, &var));
441  FAIL_IF(group != 0 || var != 0);
442 
443  FAIL_IF(!DetectDNP3ObjParse("255,255", &group, &var));
444  FAIL_IF(group != 255 || var != 255);
445 
446  FAIL_IF(DetectDNP3ObjParse("-1,-1", &group, &var));
447  FAIL_IF(DetectDNP3ObjParse("256,256", &group, &var));
448  FAIL_IF(DetectDNP3ObjParse("a,1", &group, &var));
449  FAIL_IF(DetectDNP3ObjParse("1,a", &group, &var));
450 
451  PASS;
452 }
453 
454 static void DetectDNP3FuncRegisterTests(void)
455 {
456  UtRegisterTest("DetectDNP3FuncTest01", DetectDNP3FuncTest01);
457 }
458 
459 static void DetectDNP3ObjRegisterTests(void)
460 {
461  UtRegisterTest("DetectDNP3ObjParseTest", DetectDNP3ObjParseTest);
462  UtRegisterTest("DetectDNP3ObjSetupTest", DetectDNP3ObjSetupTest);
463 }
464 #endif
util-byte.h
SIGMATCH_INFO_UINT16
#define SIGMATCH_INFO_UINT16
Definition: detect.h:1689
detect-engine-uint.h
SigTableElmt_::url
const char * url
Definition: detect.h:1461
detect-engine.h
FAIL_IF_NULL
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition: util-unittest.h:89
SIGMATCH_INFO_STICKY_BUFFER
#define SIGMATCH_INFO_STICKY_BUFFER
Definition: detect.h:1675
SigTableElmt_::desc
const char * desc
Definition: detect.h:1460
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:79
DetectEngineInspectBufferGeneric
uint8_t DetectEngineInspectBufferGeneric(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
Definition: detect-engine.c:2049
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1445
flow-util.h
DetectBufferGetFirstSigMatch
SigMatch * DetectBufferGetFirstSigMatch(const Signature *s, const uint32_t buf_id)
Definition: detect-engine-buffer.c:157
SigTableElmt_::name
const char * name
Definition: detect.h:1458
stream-tcp.h
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
DetectEngineTransforms
Definition: detect.h:391
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition: util-unittest.c:103
SigTableElmt_::flags
uint32_t flags
Definition: detect.h:1449
DetectDNP3Register
void DetectDNP3Register(void)
Definition: detect-dnp3.c:364
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:279
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DNP3Object_
Struct to hold the list of decoded objects.
Definition: app-layer-dnp3.h:192
InspectionBuffer
Definition: detect-engine-inspect-buffer.h:34
Flow_
Flow data structure.
Definition: flow.h:348
ctx
struct Thresholds ctx
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:933
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:252
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2634
SigTableElmt_::AppLayerTxMatch
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1423
DetectDNP3_
Definition: detect-dnp3.c:42
DNP3Transaction_::objects
DNP3ObjectList objects
Definition: app-layer-dnp3.h:221
detect-dnp3.h
SCDetectBufferSetActiveList
int SCDetectBufferSetActiveList(DetectEngineCtx *de_ctx, Signature *s, const int list)
Definition: detect-engine-buffer.c:29
SCDetectSignatureSetAppProto
int SCDetectSignatureSetAppProto(Signature *s, AppProto alproto)
Definition: detect-parse.c:2229
DetectEngineAppendSig
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
Definition: detect-parse.c:3440
SIG_FLAG_TOCLIENT
#define SIG_FLAG_TOCLIENT
Definition: detect.h:272
DNP3Transaction_::buffer_len
uint32_t buffer_len
Definition: app-layer-dnp3.h:220
InspectionBufferGet
InspectionBuffer * InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id)
Definition: detect-engine-inspect-buffer.c:56
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1440
DETECT_DNP3DATA
@ DETECT_DNP3DATA
Definition: detect-engine-register.h:264
detect-engine-prefilter.h
util-unittest.h
util-unittest-helper.h
DetectBufferTypeGetByName
int DetectBufferTypeGetByName(const char *name)
Definition: detect-engine.c:1278
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
StringParseUint8
int StringParseUint8(uint8_t *res, int base, size_t len, const char *str)
Definition: util-byte.c:323
SIG_FLAG_TOSERVER
#define SIG_FLAG_TOSERVER
Definition: detect.h:271
DNP3Transaction_::ah
DNP3ApplicationHeader ah
Definition: app-layer-dnp3.h:224
PASS
#define PASS
Pass the test.
Definition: util-unittest.h:105
DETECT_DNP3IND
@ DETECT_DNP3IND
Definition: detect-engine-register.h:266
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:18
DetectEngineThreadCtx_
Definition: detect.h:1245
DNP3Transaction_::iin
DNP3InternalInd iin
Definition: app-layer-dnp3.h:225
ALPROTO_DNP3
@ ALPROTO_DNP3
Definition: app-layer-protos.h:50
app-layer-dnp3.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:281
detect-engine-mpm.h
SCSigMatchAppendSMToList
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:388
detect.h
PrefilterGenericMpmRegister
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:1577
DetectU8Data
DetectUintData_u8 DetectU8Data
Definition: detect-engine-uint.h:43
DetectAppLayerMpmRegister
void DetectAppLayerMpmRegister(const char *name, int direction, int priority, PrefilterRegisterFunc PrefilterRegister, InspectionBufferGetDataPtr GetData, AppProto alproto, int tx_min_progress)
register an app layer keyword for mpm
Definition: detect-engine-mpm.c:152
app-layer-parser.h
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:359
SCReturn
#define SCReturn
Definition: util-debug.h:283
stream.h
DNP3Object_::group
uint8_t group
Definition: app-layer-dnp3.h:193
variation
uint8_t variation
Definition: app-layer-dnp3.h:1
DETECT_DNP3FUNC
@ DETECT_DNP3FUNC
Definition: detect-engine-register.h:265
SIGMATCH_INFO_BITFLAGS_UINT
#define SIGMATCH_INFO_BITFLAGS_UINT
Definition: detect.h:1699
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1420
DetectDNP3_::obj_variation
uint8_t obj_variation
Definition: detect-dnp3.c:45
detect-engine-content-inspection.h
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:351
DNP3Transaction_::is_request
bool is_request
Definition: app-layer-dnp3.h:215
DetectU8Match
int DetectU8Match(const uint8_t parg, const DetectUintData_u8 *du8)
Definition: detect-engine-uint.c:71
FAIL_IF
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
Definition: util-unittest.h:71
DetectBufferTypeRegister
int DetectBufferTypeRegister(const char *name)
Definition: detect-engine.c:1214
DetectU16Match
int DetectU16Match(const uint16_t parg, const DetectUintData_u16 *du16)
Definition: detect-engine-uint.c:107
flags
uint8_t flags
Definition: decode-gre.h:0
SigTableElmt_::alias
const char * alias
Definition: detect.h:1459
group
uint8_t group
Definition: app-layer-dnp3.h:0
suricata-common.h
DetectDNP3_::obj_group
uint8_t obj_group
Definition: detect-dnp3.c:44
detect-engine-buffer.h
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:942
DetectEngineInspectGenericList
uint8_t DetectEngineInspectGenericList(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Do the content inspection & validation for a signature.
Definition: detect-engine.c:1946
InspectionBuffer::inspect
const uint8_t * inspect
Definition: detect-engine-inspect-buffer.h:35
str
#define str(s)
Definition: suricata-common.h:308
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:271
SCFree
#define SCFree(p)
Definition: util-mem.h:61
DNP3Object_::variation
uint8_t variation
Definition: app-layer-dnp3.h:194
detect-parse.h
Signature_
Signature container.
Definition: detect.h:668
SigMatch_
a single match condition for a signature
Definition: detect.h:356
SIGMATCH_INFO_UINT8
#define SIGMATCH_INFO_UINT8
Definition: detect.h:1687
InspectionBufferSetupAndApplyTransforms
void InspectionBufferSetupAndApplyTransforms(DetectEngineThreadCtx *det_ctx, const int list_id, InspectionBuffer *buffer, const uint8_t *data, const uint32_t data_len, const DetectEngineTransforms *transforms)
setup the buffer with our initial data
Definition: detect-engine-inspect-buffer.c:197
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2595
DETECT_DNP3OBJ
@ DETECT_DNP3OBJ
Definition: detect-engine-register.h:267
SIGMATCH_NOOPT
#define SIGMATCH_NOOPT
Definition: detect.h:1650
DetectAppLayerInspectEngineRegister
void DetectAppLayerInspectEngineRegister(const char *name, AppProto alproto, uint32_t dir, int progress, InspectEngineFuncPtr Callback, InspectionBufferGetDataPtr GetData)
Registers an app inspection engine.
Definition: detect-engine.c:273
DetectDNP3
struct DetectDNP3_ DetectDNP3
DetectU16Data
DetectUintData_u16 DetectU16Data
Definition: detect-engine-uint.h:42
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:285
SIGMATCH_INFO_ENUM_UINT
#define SIGMATCH_INFO_ENUM_UINT
Definition: detect.h:1697
DNP3Transaction_
DNP3 transaction.
Definition: app-layer-dnp3.h:211
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1447
DNP3Transaction_::buffer
uint8_t * buffer
Definition: app-layer-dnp3.h:219