NCDConfig.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * @file NCDConfig.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef BADVPN_NCDCONFIG_NCDCONFIG_H
  23. #define BADVPN_NCDCONFIG_NCDCONFIG_H
  24. struct NCDConfig_interfaces;
  25. struct NCDConfig_statements;
  26. struct NCDConfig_arguments;
  27. struct NCDConfig_strings;
  28. struct NCDConfig_interfaces {
  29. int is_template;
  30. char *name;
  31. struct NCDConfig_statements *statements;
  32. struct NCDConfig_interfaces *next;
  33. };
  34. struct NCDConfig_statements {
  35. struct NCDConfig_strings *objname;
  36. struct NCDConfig_strings *names;
  37. struct NCDConfig_arguments *args;
  38. char *name;
  39. struct NCDConfig_statements *next;
  40. };
  41. #define NCDCONFIG_ARG_STRING 1
  42. #define NCDCONFIG_ARG_VAR 2
  43. struct NCDConfig_arguments {
  44. int type;
  45. union {
  46. char *string;
  47. struct NCDConfig_strings *var;
  48. };
  49. struct NCDConfig_arguments *next;
  50. };
  51. struct NCDConfig_strings {
  52. char *value;
  53. struct NCDConfig_strings *next;
  54. };
  55. void NCDConfig_free_interfaces (struct NCDConfig_interfaces *v);
  56. void NCDConfig_free_statements (struct NCDConfig_statements *v);
  57. void NCDConfig_free_arguments (struct NCDConfig_arguments *v);
  58. void NCDConfig_free_strings (struct NCDConfig_strings *v);
  59. struct NCDConfig_interfaces * NCDConfig_make_interfaces (int is_template, char *name, struct NCDConfig_statements *statements, int have_next, struct NCDConfig_interfaces *next);
  60. struct NCDConfig_statements * NCDConfig_make_statements (struct NCDConfig_strings *objname, struct NCDConfig_strings *names, struct NCDConfig_arguments *args, char *name, struct NCDConfig_statements *next);
  61. struct NCDConfig_arguments * NCDConfig_make_arguments_string (char *str, struct NCDConfig_arguments *next);
  62. struct NCDConfig_arguments * NCDConfig_make_arguments_var (struct NCDConfig_strings *var, struct NCDConfig_arguments *next);
  63. struct NCDConfig_strings * NCDConfig_make_strings (char *value, int have_next, struct NCDConfig_strings *next);
  64. int NCDConfig_statement_name_is (struct NCDConfig_statements *st, const char *needle);
  65. struct NCDConfig_statements * NCDConfig_find_statement (struct NCDConfig_statements *st, const char *needle);
  66. char * NCDConfig_concat_strings (struct NCDConfig_strings *s);
  67. #endif