tor  0.4.2.1-alpha-dev
Data Structures | Macros | Typedefs | Enumerations
conftypes.h File Reference
#include "lib/cc/torint.h"
#include <stddef.h>

Go to the source code of this file.

Data Structures

struct  struct_member_t
 
struct  struct_magic_decl_t
 
struct  config_var_t
 

Macros

#define CFLG_NODUMP   (1u<<0)
 
#define CFLG_NOLIST   (1u<<1)
 
#define CFLG_NOSET   (1u<<2)
 
#define CFLG_NOCOPY   (1u<<3)
 
#define CFLG_NOCMP   (1u<<4)
 
#define CFLG_NOREPLACE   (1u<<5)
 
#define CFLG_GROUP_OBSOLETE   (CFLG_NOCOPY|CFLG_NOCMP|CFLG_NODUMP|CFLG_NOSET|CFLG_NOLIST)
 

Typedefs

typedef enum config_type_t config_type_t
 
typedef struct struct_member_t struct_member_t
 
typedef struct struct_magic_decl_t struct_magic_decl_t
 
typedef struct config_var_t config_var_t
 

Enumerations

enum  config_type_t {
  CONFIG_TYPE_STRING = 0, CONFIG_TYPE_FILENAME, CONFIG_TYPE_POSINT, CONFIG_TYPE_INT,
  CONFIG_TYPE_UINT64, CONFIG_TYPE_INTERVAL, CONFIG_TYPE_MSEC_INTERVAL, CONFIG_TYPE_MEMUNIT,
  CONFIG_TYPE_DOUBLE, CONFIG_TYPE_BOOL, CONFIG_TYPE_AUTOBOOL, CONFIG_TYPE_ISOTIME,
  CONFIG_TYPE_CSV, CONFIG_TYPE_CSV_INTERVAL, CONFIG_TYPE_LINELIST, CONFIG_TYPE_LINELIST_S,
  CONFIG_TYPE_LINELIST_V, CONFIG_TYPE_OBSOLETE, CONFIG_TYPE_EXTENDED
}
 

Detailed Description

Types used to specify configurable options.

This header defines the types that different modules will use in order to declare their configuration and state variables, and tell the configuration management code about those variables. From the individual module's point of view, its configuration and state are simply data structures.

For defining new variable types, see var_type_def_st.h.

For the code that manipulates variables defined via this module, see lib/confmgt/, especially typedvar.h and (later) structvar.h. The configuration manager is responsible for encoding, decoding, and maintaining the configuration structures used by the various modules.

STATUS NOTE: This is a work in process refactoring. It is not yet possible for modules to define their own variables, and much of the configuration management code is still in src/app/config/.

Definition in file conftypes.h.

Macro Definition Documentation

◆ CFLG_GROUP_OBSOLETE

#define CFLG_GROUP_OBSOLETE   (CFLG_NOCOPY|CFLG_NOCMP|CFLG_NODUMP|CFLG_NOSET|CFLG_NOLIST)

A group of flags that should be set on all obsolete options and types.

Definition at line 185 of file conftypes.h.

◆ CFLG_NOCMP

#define CFLG_NOCMP   (1u<<4)

Flag to indicate that an option or type does not need to be compared when telling the controller about the differences between two configurations.

(Usually, if an option does not need to be compared, then either it contains no data, or the data that it does contain is completely contained within another option.)

Definition at line 172 of file conftypes.h.

◆ CFLG_NOCOPY

#define CFLG_NOCOPY   (1u<<3)

Flag to indicate that an option or type does not need to be copied when copying the structure that contains it.

(Usually, if an option does not need to be copied, then either it contains no data, or the data that it does contain is completely contained within another option.)

Definition at line 162 of file conftypes.h.

◆ CFLG_NODUMP

#define CFLG_NODUMP   (1u<<0)

Flag to indicate that an option or type is "undumpable". An undumpable option is never saved to disk.

For historical reasons its name is usually is prefixed with __.

Definition at line 140 of file conftypes.h.

◆ CFLG_NOLIST

#define CFLG_NOLIST   (1u<<1)

Flag to indicate that an option or type is "unlisted".

We don't tell the controller about unlisted options when it asks for a list of them.

Definition at line 147 of file conftypes.h.

◆ CFLG_NOREPLACE

#define CFLG_NOREPLACE   (1u<<5)

Flag to indicate that an option or type should not be replaced when setting it.

For most options, setting them replaces their old value. For some options, however, setting them appends to their old value.

Definition at line 180 of file conftypes.h.

◆ CFLG_NOSET

#define CFLG_NOSET   (1u<<2)

Flag to indicate that an option or type is "unsettable".

An unsettable option can never be set directly by name.

Definition at line 153 of file conftypes.h.

Typedef Documentation

◆ config_type_t

Enumeration of types which option values can take

◆ config_var_t

typedef struct config_var_t config_var_t

A variable allowed in the configuration file or on the command line.

◆ struct_magic_decl_t

Structure to describe the location and preferred value of a "magic number" field within a structure.

These 'magic numbers' are 32-bit values used to tag objects to make sure that they have the correct type.

◆ struct_member_t

Structure to specify a named, typed member within a structure.

Enumeration Type Documentation

◆ config_type_t

Enumeration of types which option values can take

Enumerator
CONFIG_TYPE_STRING 

An arbitrary string.

CONFIG_TYPE_FILENAME 

A filename: some prefixes get expanded.

CONFIG_TYPE_POSINT 

A non-negative integer less than MAX_INT

CONFIG_TYPE_INT 

Any integer.

CONFIG_TYPE_UINT64 

A value in range 0..UINT64_MAX

CONFIG_TYPE_INTERVAL 

A number of seconds, with optional units

CONFIG_TYPE_MSEC_INTERVAL 

A number of milliseconds, with optional units

CONFIG_TYPE_MEMUNIT 

A number of bytes, with optional units

CONFIG_TYPE_DOUBLE 

A floating-point value

CONFIG_TYPE_BOOL 

A boolean value, expressed as 0 or 1.

CONFIG_TYPE_AUTOBOOL 

A boolean+auto value, expressed 0 for false, 1 for true, and -1 for auto

CONFIG_TYPE_ISOTIME 

An ISO-formatted time relative to UTC.

CONFIG_TYPE_CSV 

A list of strings, separated by commas and optional whitespace.

CONFIG_TYPE_CSV_INTERVAL 

A list of strings, separated by commas and optional whitespace, representing intervals in seconds, with optional units. We allow multiple values here for legacy reasons, but ignore every value after the first.

CONFIG_TYPE_LINELIST 

Uninterpreted config lines

CONFIG_TYPE_LINELIST_S 

Uninterpreted, context-sensitive config lines, mixed with other keywords.

CONFIG_TYPE_LINELIST_V 

Catch-all "virtual" option to summarize context-sensitive config lines when fetching.

CONFIG_TYPE_OBSOLETE 

Obsolete (ignored) option.

CONFIG_TYPE_EXTENDED 

Extended type: definition appears in the type_def pointer of the corresponding struct_member_t.

For some types, we cannot define them as particular values of this enumeration, since those types are abstractions defined at a higher level than this module. (For example, parsing a routerset_t is higher-level than this module.) To handle this, we use CONFIG_TYPE_EXTENDED for those types, and give a definition for them in the struct_member_t.type_def.

Definition at line 39 of file conftypes.h.