lighttpd 1.4.x https://www.lighttpd.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

  1. #ifndef _CONFIG_PARSER_H_
  2. #define _CONFIG_PARSER_H_
  3. #include "first.h"
  4. #include "base_decls.h"
  5. #include "plugin_config.h"
  6. #include "array.h"
  7. #include "buffer.h"
  8. #include "vector.h"
  9. /* $HTTP["host"] == "incremental.home.kneschke.de" { ... }
  10. * for print: comp_key op string
  11. * for compare: comp cond string/regex
  12. */
  13. #ifdef HAVE_PCRE_H
  14. struct pcre_extra; /* declaration */
  15. #endif
  16. typedef struct data_config data_config;
  17. DEFINE_TYPED_VECTOR_NO_RELEASE(config_weak, data_config*);
  18. struct data_config {
  19. DATA_UNSET;
  20. int context_ndx; /* more or less like an id */
  21. comp_key_t comp;
  22. config_cond_t cond;
  23. /* nested */
  24. data_config *parent;
  25. /* for chaining only */
  26. data_config *prev;
  27. data_config *next;
  28. buffer string;
  29. #ifdef HAVE_PCRE_H
  30. void *regex;
  31. struct pcre_extra *regex_study;
  32. #endif
  33. int ext;
  34. buffer *comp_tag;
  35. buffer *comp_key;
  36. const char *op;
  37. vector_config_weak children;
  38. array *value;
  39. };
  40. __attribute_cold__
  41. data_config *data_config_init(void);
  42. __attribute_cold__
  43. int data_config_pcre_compile(data_config *dc);
  44. /*struct cond_cache_t;*/ /* declaration */ /*(moved to plugin_config.h)*/
  45. /*int data_config_pcre_exec(const data_config *dc, struct cond_cache_t *cache, buffer *b);*/
  46. typedef struct {
  47. server *srv;
  48. int ok;
  49. array *all_configs;
  50. vector_config_weak configs_stack; /* to parse nested block */
  51. data_config *current; /* current started with { */
  52. buffer *basedir;
  53. } config_t;
  54. __attribute_cold__
  55. void *configparserAlloc(void *(*mallocProc)(size_t));
  56. __attribute_cold__
  57. void configparserFree(void *p, void (*freeProc)(void*));
  58. __attribute_cold__
  59. void configparser(void *yyp, int yymajor, buffer *yyminor, config_t *ctx);
  60. __attribute_cold__
  61. int config_parse_file(server *srv, config_t *context, const char *fn);
  62. __attribute_cold__
  63. int config_parse_cmd(server *srv, config_t *context, const char *cmd);
  64. #endif