conf.h 2.3 KB

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