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 __UTIL_CLASSIFICATION_CONFIG_H__
25 #define __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.confg */
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 
54 void SCClassConfInit(void);
55 void SCClassConfDeinit(void);
56 
57 /* for unittests */
58 #ifdef UNITTESTS
59 void SCClassConfRegisterTests(void);
63 #endif
64 
65 #endif /* __UTIL_CLASSIFICATION_CONFIG_H__ */
void SCClassConfDeinit(void)
void SCClassConfRegisterTests(void)
This function registers unit tests for Classification Config API.
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...
FILE * SCClassConfGenerateInValidDummyClassConfigFD03(void)
Creates a dummy classification file, with all invalid Classtypes, for testing purposes.
FILE * SCClassConfGenerateValidDummyClassConfigFD01(void)
Creates a dummy classification file, with all valid Classtypes, for testing purposes.
struct SCClassConfClasstype_ SCClassConfClasstype
Container for a Classtype from the Classification.config file.
main detection engine ctx
Definition: detect.h:761
FILE * SCClassConfGenerateInValidDummyClassConfigFD02(void)
Creates a dummy classification file, with some valid Classtypes and a couple of invalid Classtypes...
SCClassConfClasstype * SCClassConfGetClasstype(const char *, DetectEngineCtx *)
Gets the classtype from the corresponding hash table stored in the Detection Engine Context&#39;s class c...
void SCClassConfInit(void)
void SCClassConfDeInitContext(DetectEngineCtx *)
Releases resources used by the Classification Config API.
void SCClassConfLoadClassficationConfigFile(DetectEngineCtx *, FILE *fd)
Loads the Classtype info from the classification.config file.
Container for a Classtype from the Classification.config file.