suricata
detect-noalert.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2010 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  * Implements the noalert keyword
24  */
25 
26 #include "suricata-common.h"
27 #include "detect.h"
28 #include "detect-noalert.h"
29 #include "util-debug.h"
30 
31 static int DetectNoalertSetup (DetectEngineCtx *, Signature *, const char *);
32 
34 {
35  sigmatch_table[DETECT_NOALERT].name = "noalert";
36  sigmatch_table[DETECT_NOALERT].desc = "no alert will be generated by the rule";
37  sigmatch_table[DETECT_NOALERT].url = "/rules/flow-keywords.html";
39  sigmatch_table[DETECT_NOALERT].Setup = DetectNoalertSetup;
42 
44 }
45 
46 static int DetectNoalertSetup (DetectEngineCtx *de_ctx, Signature *s, const char *nullstr)
47 {
48  if (nullstr != NULL) {
49  SCLogError(SC_ERR_INVALID_VALUE, "nocase has no value");
50  return -1;
51  }
52 
53  s->flags |= SIG_FLAG_NOALERT;
54  return 0;
55 }
56 
SigTableElmt_::url
const char * url
Definition: detect.h:1212
SigTableElmt_::desc
const char * desc
Definition: detect.h:1211
detect-noalert.h
SC_ERR_INVALID_VALUE
@ SC_ERR_INVALID_VALUE
Definition: util-error.h:160
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1200
SigTableElmt_::name
const char * name
Definition: detect.h:1209
SigTableElmt_::flags
uint16_t flags
Definition: detect.h:1203
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:766
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1195
util-debug.h
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
detect.h
Signature_::flags
uint32_t flags
Definition: detect.h:528
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1178
DETECT_NOALERT
@ DETECT_NOALERT
Definition: detect-engine-register.h:85
suricata-common.h
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:73
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:257
SIG_FLAG_NOALERT
#define SIG_FLAG_NOALERT
Definition: detect.h:216
DetectNoalertRegister
void DetectNoalertRegister(void)
Definition: detect-noalert.c:33
Signature_
Signature container.
Definition: detect.h:527
SIGMATCH_NOOPT
#define SIGMATCH_NOOPT
Definition: detect.h:1378
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1201