conf.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef TINC_CONF_H
  2. #define TINC_CONF_H
  3. /*
  4. conf.h -- header for conf.c
  5. Copyright (C) 1998-2005 Ivo Timmermans
  6. 2000-2012 Guus Sliepen <guus@tinc-vpn.org>
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. */
  19. #include "avl_tree.h"
  20. #include "list.h"
  21. typedef struct config_t {
  22. char *variable;
  23. char *value;
  24. char *file;
  25. int line;
  26. } config_t;
  27. #include "subnet.h"
  28. extern avl_tree_t *config_tree;
  29. extern int pinginterval;
  30. extern int pingtimeout;
  31. extern int maxtimeout;
  32. extern int mintimeout;
  33. extern bool bypass_security;
  34. extern char *confbase;
  35. extern char *netname;
  36. extern list_t *cmdline_conf;
  37. extern void init_configuration(avl_tree_t **config_tree);
  38. extern void exit_configuration(avl_tree_t **config_tree);
  39. extern config_t *new_config(void) __attribute__((__malloc__));
  40. extern void free_config(config_t *cfg);
  41. extern void config_add(avl_tree_t *config_tree, config_t *cfg);
  42. extern config_t *lookup_config(const avl_tree_t *config_tree, char *variable);
  43. extern config_t *lookup_config_next(const avl_tree_t *config_tree, const config_t *cfg);
  44. extern bool get_config_bool(const config_t *cfg, bool *result);
  45. extern bool get_config_int(const config_t *cfg, int *result);
  46. extern bool get_config_string(const config_t *cfg, char **result);
  47. extern bool get_config_address(const config_t *cfg, struct addrinfo **result);
  48. extern bool get_config_subnet(const config_t *cfg, struct subnet_t **result);
  49. extern config_t *parse_config_line(char *line, const char *fname, int lineno);
  50. extern bool read_config_file(avl_tree_t *config_tree, const char *fname);
  51. extern void read_config_options(avl_tree_t *config_tree, const char *prefix);
  52. extern bool read_server_config(void);
  53. extern bool read_connection_config(struct connection_t *c);
  54. extern FILE *ask_and_open(const char *fname, const char *what);
  55. #endif