fix typo
[tor.git] / src / common / confline.h
blob477c6929a25c2af5c51e46c828315a2c3a67124a
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-2017, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 #ifndef TOR_CONFLINE_H
8 #define TOR_CONFLINE_H
10 /** Ordinary configuration line. */
11 #define CONFIG_LINE_NORMAL 0
12 /** Appends to previous configuration for the same option, even if we
13 * would ordinary replace it. */
14 #define CONFIG_LINE_APPEND 1
15 /* Removes all previous configuration for an option. */
16 #define CONFIG_LINE_CLEAR 2
18 /** A linked list of lines in a config file, or elsewhere */
19 typedef struct config_line_t {
20 char *key;
21 char *value;
22 struct config_line_t *next;
24 /** What special treatment (if any) does this line require? */
25 unsigned int command:2;
26 /** If true, subsequent assignments to this linelist should replace
27 * it, not extend it. Set only on the first item in a linelist in an
28 * or_options_t. */
29 unsigned int fragile:1;
30 } config_line_t;
32 void config_line_append(config_line_t **lst,
33 const char *key, const char *val);
34 void config_line_prepend(config_line_t **lst,
35 const char *key, const char *val);
36 config_line_t *config_lines_dup(const config_line_t *inp);
37 config_line_t *config_lines_dup_and_filter(const config_line_t *inp,
38 const char *key);
39 const config_line_t *config_line_find(const config_line_t *lines,
40 const char *key);
41 int config_lines_eq(config_line_t *a, config_line_t *b);
42 int config_count_key(const config_line_t *a, const char *key);
43 int config_get_lines(const char *string, config_line_t **result, int extended);
44 void config_free_lines(config_line_t *front);
45 const char *parse_config_line_from_str_verbose(const char *line,
46 char **key_out, char **value_out,
47 const char **err_out);
48 #endif