tor  0.4.2.1-alpha-dev
confline.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 
13 #ifndef TOR_CONFLINE_H
14 #define TOR_CONFLINE_H
15 
16 struct smartlist_t;
17 
19 #define CONFIG_LINE_NORMAL 0
20 
22 #define CONFIG_LINE_APPEND 1
23 /* Removes all previous configuration for an option. */
24 #define CONFIG_LINE_CLEAR 2
25 
26 #define MAX_INCLUDE_RECURSION_LEVEL 31
27 
29 typedef struct config_line_t {
30  char *key;
31  char *value;
32  struct config_line_t *next;
33 
35  unsigned int command:2;
39  unsigned int fragile:1;
41 
43  const char *key, const char *val);
45  const char *key, const char *val);
48  const char *key);
49 const config_line_t *config_line_find(const config_line_t *lines,
50  const char *key);
52  const char *key);
53 int config_lines_eq(const config_line_t *a, const config_line_t *b);
54 int config_count_key(const config_line_t *a, const char *key);
56 #define config_free_lines(front) \
57  do { \
58  config_free_lines_(front); \
59  (front) = NULL; \
60  } while (0)
61 const char *parse_config_line_from_str_verbose(const char *line,
62  char **key_out, char **value_out,
63  const char **err_out);
64 
65 int config_get_lines(const char *string, struct config_line_t **result,
66  int extended);
67 
68 typedef int (*include_handler_fn)(const char *, int, int,
69  struct config_line_t **,
70  struct config_line_t **,
71  struct smartlist_t *);
72 
73 int config_get_lines_aux(const char *string, struct config_line_t **result,
74  int extended,
75  int allow_include, int *has_include,
76  struct smartlist_t *opened_lst, int recursion_level,
77  config_line_t **last,
78  include_handler_fn handle_include);
79 
80 #endif /* !defined(TOR_CONFLINE_H) */
void config_free_lines_(config_line_t *front)
Definition: confline.c:211
const config_line_t * config_line_find_case(const config_line_t *lines, const char *key)
Definition: confline.c:87
const char * parse_config_line_from_str_verbose(const char *line, char **key_out, char **value_out, const char **err_out)
Definition: confline.c:296
int config_lines_eq(const config_line_t *a, const config_line_t *b)
Definition: confline.c:259
int config_count_key(const config_line_t *a, const char *key)
Definition: confline.c:274
unsigned int command
Definition: confline.h:35
config_line_t * config_lines_dup(const config_line_t *inp)
Definition: confline.c:227
void config_line_prepend(config_line_t **lst, const char *key, const char *val)
Definition: confline.c:53
void config_line_append(config_line_t **lst, const char *key, const char *val)
Definition: confline.c:32
unsigned int fragile
Definition: confline.h:39
config_line_t * config_lines_dup_and_filter(const config_line_t *inp, const char *key)
Definition: confline.c:236
int config_get_lines(const char *string, struct config_line_t **result, int extended)
Definition: confline.c:201
int config_get_lines_aux(const char *string, struct config_line_t **result, int extended, int allow_include, int *has_include, struct smartlist_t *opened_lst, int recursion_level, config_line_t **last, include_handler_fn handle_include)
Definition: confline.c:104
const config_line_t * config_line_find(const config_line_t *lines, const char *key)
Definition: confline.c:74
struct config_line_t config_line_t