tor  0.4.2.1-alpha-dev
conftypes.h
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
28 #ifndef TOR_SRC_LIB_CONF_CONFTYPES_H
29 #define TOR_SRC_LIB_CONF_CONFTYPES_H
30 
31 #include "lib/cc/torint.h"
32 #ifdef TOR_UNIT_TESTS
33 #include "lib/conf/conftesting.h"
34 #endif
35 
36 #include <stddef.h>
37 
39 typedef enum config_type_t {
80 
81 /* Forward delcaration for var_type_def_t, for extended types. */
82 struct var_type_def_t;
83 
85 typedef struct struct_member_t {
87  const char *name;
95  /*
96  * NOTE: In future refactoring, we might remove this field entirely, along
97  * with its corresponding enumeration. In that case, we will require that
98  * type_def be set in all cases. If we do, we will also need a new mechanism
99  * to enforce consistency between configuration variable types and their
100  * corresponding structures, since our current design in
101  * lib/conf/conftesting.h won't work any more.
102  */
109  const struct var_type_def_t *type_def;
114  ptrdiff_t offset;
116 
124 typedef struct struct_magic_decl_t {
126  const char *typename;
128  uint32_t magic_val;
131  ptrdiff_t magic_offset;
133 
140 #define CFLG_NODUMP (1u<<0)
141 
147 #define CFLG_NOLIST (1u<<1)
148 
153 #define CFLG_NOSET (1u<<2)
154 
162 #define CFLG_NOCOPY (1u<<3)
163 
172 #define CFLG_NOCMP (1u<<4)
173 
180 #define CFLG_NOREPLACE (1u<<5)
181 
185 #define CFLG_GROUP_OBSOLETE \
186  (CFLG_NOCOPY|CFLG_NOCMP|CFLG_NODUMP|CFLG_NOSET|CFLG_NOLIST)
187 
189 typedef struct config_var_t {
190  struct_member_t member;
192  const char *initvalue;
193  uint32_t flags;
195 #ifdef TOR_UNIT_TESTS
196 
198  confparse_dummy_values_t var_ptr_dummy;
199 #endif
200 } config_var_t;
201 
202 #endif /* !defined(TOR_SRC_LIB_CONF_CONFTYPES_H) */
Macro and type declarations for testing.
struct struct_magic_decl_t struct_magic_decl_t
struct config_var_t config_var_t
uint32_t flags
Definition: conftypes.h:193
Integer definitions used throughout Tor.
struct struct_member_t struct_member_t
ptrdiff_t offset
Definition: conftypes.h:114
const char * name
Definition: conftypes.h:87
uint32_t magic_val
Definition: conftypes.h:128
const char * initvalue
Definition: conftypes.h:192
config_type_t type
Definition: conftypes.h:103
config_type_t
Definition: conftypes.h:39
const struct var_type_def_t * type_def
Definition: conftypes.h:109
ptrdiff_t magic_offset
Definition: conftypes.h:131