suricata
util-classification-config.h
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 Anoop Saldanha <anoopsaldanha@gmail.com>
22  */
23 
24 #ifndef SURICATA_UTIL_CLASSIFICATION_CONFIG_H
25 #define SURICATA_UTIL_CLASSIFICATION_CONFIG_H
26 
27 #define CLASSTYPE_NAME_MAX_LEN 64
28 #define CLASSTYPE_DESC_MAX_LEN 512
29 
30 /**
31  * \brief Container for a Classtype from the Classification.config file.
32  */
33 typedef struct SCClassConfClasstype_ {
34  /* The index of the classification within classification.config */
35  uint16_t classtype_id;
36 
37  /* The priority this classification type carries */
38  int priority;
39 
40  /* The classtype name. This is the primary key for a Classification. */
41  char *classtype;
42 
43  /* Description for a classification. Would be used while printing out
44  * the classification info for a Signature, by the fast-log module. */
47 
49 int SCClassConfAddClasstype(DetectEngineCtx *de_ctx, char *rawstr, uint16_t index);
51  DetectEngineCtx *);
53 
56 
57 /* for unittests */
58 #ifdef UNITTESTS
59 void SCClassConfRegisterTests(void);
63 #endif
64 
65 #endif /* SURICATA_UTIL_CLASSIFICATION_CONFIG_H */
SCClassConfDeInitContext
void SCClassConfDeInitContext(DetectEngineCtx *)
Releases resources used by the Classification Config API.
Definition: util-classification-config.c:190
SCClassConfClasstype_::classtype
char * classtype
Definition: util-classification-config.h:41
SCClassConfDeinit
void SCClassConfDeinit(DetectEngineCtx *de_ctx)
Definition: util-classification-config.c:81
SCClassConfRegisterTests
void SCClassConfRegisterTests(void)
This function registers unit tests for Classification Config API.
Definition: util-classification-config.c:783
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:841
SCClassConfGenerateInvalidDummyClassConfigFD02
FILE * SCClassConfGenerateInvalidDummyClassConfigFD02(void)
Creates a dummy classification file, with some valid Classtypes and a couple of invalid Classtypes,...
Definition: util-classification-config.c:607
SCClassConfGenerateValidDummyClassConfigFD01
FILE * SCClassConfGenerateValidDummyClassConfigFD01(void)
Creates a dummy classification file, with all valid Classtypes, for testing purposes.
Definition: util-classification-config.c:587
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
SCClassConfClasstype_
Container for a Classtype from the Classification.config file.
Definition: util-classification-config.h:33
SCClassConfClasstype_::classtype_id
uint16_t classtype_id
Definition: util-classification-config.h:35
SCClassConfGenerateInvalidDummyClassConfigFD03
FILE * SCClassConfGenerateInvalidDummyClassConfigFD03(void)
Creates a dummy classification file, with all invalid Classtypes, for testing purposes.
Definition: util-classification-config.c:631
SCClassConfGetClasstype
SCClassConfClasstype * SCClassConfGetClasstype(const char *, DetectEngineCtx *)
Gets the classtype from the corresponding hash table stored in the Detection Engine Context's class c...
Definition: util-classification-config.c:561
SCClassConfClasstype_::priority
int priority
Definition: util-classification-config.h:38
SCClassConfLoadClassificationConfigFile
bool SCClassConfLoadClassificationConfigFile(DetectEngineCtx *, FILE *fd)
Loads the Classtype info from the classification.config file.
Definition: util-classification-config.c:524
SCClassConfInit
void SCClassConfInit(DetectEngineCtx *de_ctx)
Definition: util-classification-config.c:61
SCClassConfClasstype_::classtype_desc
char * classtype_desc
Definition: util-classification-config.h:45
SCClassConfClasstype
struct SCClassConfClasstype_ SCClassConfClasstype
Container for a Classtype from the Classification.config file.
SCClassConfAddClasstype
int SCClassConfAddClasstype(DetectEngineCtx *de_ctx, char *rawstr, uint16_t index)
Parses a line from the classification file and adds it to Classtype hash table in DetectEngineCtx,...
Definition: util-classification-config.c:233