suricata
util-var.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2024 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 SURICATA_UTIL_VAR_H
25 #define SURICATA_UTIL_VAR_H
26 
27 /** variable types: these are used to track variable names */
28 enum VarTypes {
30 
34  VAR_TYPE_PKT_VAR_KV, // key-value
35 
39 
43 
47 };
48 
49 /** \todo see ticket #6855. The type field should be 16 bits. */
50 typedef struct GenericVar_ {
51  uint8_t type; /**< variable type, uses detection sm_type */
52  uint8_t pad[3];
53  uint32_t idx;
54  struct GenericVar_ *next;
56 
57 typedef struct XBit_ {
58  uint8_t type; /* type, DETECT_XBITS in this case */
59  uint8_t pad[3];
60  uint32_t idx; /* name idx */
62  uint32_t expire;
63 } XBit;
64 
65 void XBitFree(XBit *);
66 
67 // A list of variables we try to resolve while parsing configuration file.
68 // Helps to detect recursive declarations.
69 typedef struct ResolvedVariable_ {
70  char var_name[256];
73 
74 typedef TAILQ_HEAD(, ResolvedVariable_) ResolvedVariablesList;
75 
79 
80 int AddVariableToResolveList(ResolvedVariablesList *list, const char *var);
81 void CleanVariableResolveList(ResolvedVariablesList *var_list);
82 
83 #endif /* SURICATA_UTIL_VAR_H */
GenericVar_::type
uint8_t type
Definition: util-var.h:51
XBit_::expire
uint32_t expire
Definition: util-var.h:62
XBit_::next
GenericVar * next
Definition: util-var.h:61
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
VAR_TYPE_IPPAIR_VAR
@ VAR_TYPE_IPPAIR_VAR
Definition: util-var.h:46
ResolvedVariable_
Definition: util-var.h:69
GenericVarFree
void GenericVarFree(GenericVar *)
Definition: util-var.c:48
GenericVarAppend
void GenericVarAppend(GenericVar **, GenericVar *)
Definition: util-var.c:98
VAR_TYPE_HOST_VAR
@ VAR_TYPE_HOST_VAR
Definition: util-var.h:42
VAR_TYPE_PKT_INT
@ VAR_TYPE_PKT_INT
Definition: util-var.h:32
VAR_TYPE_PKT_VAR_KV
@ VAR_TYPE_PKT_VAR_KV
Definition: util-var.h:34
VAR_TYPE_NOT_SET
@ VAR_TYPE_NOT_SET
Definition: util-var.h:29
GenericVar_::pad
uint8_t pad[3]
Definition: util-var.h:52
GenericVar_::next
struct GenericVar_ * next
Definition: util-var.h:54
AddVariableToResolveList
int AddVariableToResolveList(ResolvedVariablesList *list, const char *var)
Definition: util-var.c:139
TAILQ_HEAD
typedef TAILQ_HEAD(, ResolvedVariable_) ResolvedVariablesList
XBit
struct XBit_ XBit
ResolvedVariable_::var_name
char var_name[256]
Definition: util-var.h:70
GenericVar_::idx
uint32_t idx
Definition: util-var.h:53
VAR_TYPE_PKT_BIT
@ VAR_TYPE_PKT_BIT
Definition: util-var.h:31
ResolvedVariable
struct ResolvedVariable_ ResolvedVariable
XBit_::type
uint8_t type
Definition: util-var.h:58
GenericVarRemove
void GenericVarRemove(GenericVar **, GenericVar *)
Definition: util-var.c:117
VAR_TYPE_FLOW_BIT
@ VAR_TYPE_FLOW_BIT
Definition: util-var.h:36
GenericVar_
Definition: util-var.h:50
CleanVariableResolveList
void CleanVariableResolveList(ResolvedVariablesList *var_list)
Definition: util-var.c:168
ResolvedVariable_::TAILQ_ENTRY
TAILQ_ENTRY(ResolvedVariable_) next
XBitFree
void XBitFree(XBit *)
Definition: util-var.c:40
VAR_TYPE_HOST_BIT
@ VAR_TYPE_HOST_BIT
Definition: util-var.h:40
VAR_TYPE_IPPAIR_INT
@ VAR_TYPE_IPPAIR_INT
Definition: util-var.h:45
VAR_TYPE_FLOW_VAR
@ VAR_TYPE_FLOW_VAR
Definition: util-var.h:38
VAR_TYPE_FLOW_INT
@ VAR_TYPE_FLOW_INT
Definition: util-var.h:37
VarTypes
VarTypes
Definition: util-var.h:28
VAR_TYPE_HOST_INT
@ VAR_TYPE_HOST_INT
Definition: util-var.h:41
XBit_::idx
uint32_t idx
Definition: util-var.h:60
XBit_::pad
uint8_t pad[3]
Definition: util-var.h:59
GenericVar
struct GenericVar_ GenericVar
XBit_
Definition: util-var.h:57
VAR_TYPE_IPPAIR_BIT
@ VAR_TYPE_IPPAIR_BIT
Definition: util-var.h:44
VAR_TYPE_PKT_VAR
@ VAR_TYPE_PKT_VAR
Definition: util-var.h:33