suricata
util-var.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 Victor Julien <victor@inliniac.net>
22  */
23 
24 #ifndef __UTIL_VAR_H__
25 #define __UTIL_VAR_H__
26 
27 enum VarTypes {
29 
33  VAR_TYPE_PKT_VAR_KV, // key-value
34 
38 
42 
46 };
47 
48 typedef struct GenericVar_ {
49  uint8_t type;
50  uint8_t pad[3];
51  uint32_t idx;
52  struct GenericVar_ *next;
53 } GenericVar;
54 
55 typedef struct XBit_ {
56  uint8_t type; /* type, DETECT_XBITS in this case */
57  uint8_t pad[3];
58  uint32_t idx; /* name idx */
60  uint32_t expire;
61 } XBit;
62 
63 void XBitFree(XBit *);
64 
65 // A list of variables we try to resolve while parsing configuration file.
66 // Helps to detect recursive declarations.
67 typedef struct ResolvedVariable_ {
68  char var_name[256];
71 
72 typedef TAILQ_HEAD(, ResolvedVariable_) ResolvedVariablesList;
73 
75 void GenericVarAppend(GenericVar **, GenericVar *);
76 void GenericVarRemove(GenericVar **, GenericVar *);
77 
78 int AddVariableToResolveList(ResolvedVariablesList *list, const char *var);
79 void CleanVariableResolveList(ResolvedVariablesList *var_list);
80 
81 #endif /* __UTIL_VAR_H__ */
82 
uint32_t expire
Definition: util-var.h:60
VarTypes
Definition: util-var.h:27
uint8_t type
Definition: util-var.h:49
struct GenericVar_ GenericVar
Definition: util-var.h:55
void CleanVariableResolveList(ResolvedVariablesList *var_list)
Definition: util-var.c:162
uint8_t pad[3]
Definition: util-var.h:50
void XBitFree(XBit *)
Definition: util-var.c:39
uint32_t idx
Definition: util-var.h:51
void GenericVarFree(GenericVar *)
Definition: util-var.c:47
struct GenericVar_ * next
Definition: util-var.h:52
void GenericVarAppend(GenericVar **, GenericVar *)
Definition: util-var.c:92
uint32_t idx
Definition: util-var.h:58
GenericVar * next
Definition: util-var.h:59
uint8_t type
Definition: util-var.h:56
#define TAILQ_ENTRY(type)
Definition: queue.h:330
void GenericVarRemove(GenericVar **, GenericVar *)
Definition: util-var.c:111
typedef TAILQ_HEAD(, ResolvedVariable_) ResolvedVariablesList
struct XBit_ XBit
int AddVariableToResolveList(ResolvedVariablesList *list, const char *var)
Definition: util-var.c:133