suricata
detect-icmpv4hdr.c
Go to the documentation of this file.
1
/* Copyright (C) 2020 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 "../detect.h"
21
#include "../detect-parse.h"
22
23
#include "../detect-icmpv4hdr.h"
24
25
#include "../util-unittest.h"
26
27
static
int
DetectIcmpv4HdrParseTest01(
void
)
28
{
29
DetectEngineCtx
*
de_ctx
=
DetectEngineCtxInit
();
30
FAIL_IF_NULL
(
de_ctx
);
31
32
FAIL_IF_NULL
(
DetectEngineAppendSig
(
33
de_ctx
,
"alert icmp any any -> any any (icmpv4.hdr; content:\"A\"; sid:1; rev:1;)"
));
34
35
DetectEngineCtxFree
(
de_ctx
);
36
PASS
;
37
}
38
39
/**
40
* \brief this function registers unit tests for DetectIcmpv4Hdr
41
*/
42
void
DetectIcmpv4HdrRegisterTests
(
void
)
43
{
44
UtRegisterTest
(
"DetectIcmpv4HdrParseTest01"
, DetectIcmpv4HdrParseTest01);
45
}
FAIL_IF_NULL
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition:
util-unittest.h:89
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition:
util-unittest.c:103
DetectEngineCtx_
main detection engine ctx
Definition:
detect.h:794
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition:
detect-engine.c:2439
PASS
#define PASS
Pass the test.
Definition:
util-unittest.h:105
de_ctx
DetectEngineCtx * de_ctx
Definition:
fuzz_siginit.c:17
DetectEngineAppendSig
Signature * DetectEngineAppendSig(DetectEngineCtx *de_ctx, const char *sigstr)
Parse and append a Signature into the Detection Engine Context signature list.
Definition:
detect-parse.c:2421
DetectIcmpv4HdrRegisterTests
void DetectIcmpv4HdrRegisterTests(void)
this function registers unit tests for DetectIcmpv4Hdr
Definition:
detect-icmpv4hdr.c:42
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition:
detect-engine.c:2400
src
tests
detect-icmpv4hdr.c
Generated on Fri Jun 24 2022 23:30:34 for suricata by
1.8.18