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.

dynamic_cfg.h 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef DYNAMIC_CFG_H_
  17. #define DYNAMIC_CFG_H_
  18. #include "config.h"
  19. #include "cfg_file.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. /**
  24. * Init dynamic configuration using map logic and specific configuration
  25. * @param cfg config file
  26. */
  27. void init_dynamic_config(struct rspamd_config *cfg);
  28. /**
  29. * Dump dynamic configuration to the disk
  30. * @param cfg
  31. * @return
  32. */
  33. gboolean dump_dynamic_config(struct rspamd_config *cfg);
  34. /**
  35. * Add symbol for specified metric
  36. * @param cfg config file object
  37. * @param metric metric's name
  38. * @param symbol symbol's name
  39. * @param value value of symbol
  40. * @return
  41. */
  42. gboolean add_dynamic_symbol(struct rspamd_config *cfg,
  43. const char *metric,
  44. const char *symbol,
  45. double value);
  46. gboolean remove_dynamic_symbol(struct rspamd_config *cfg,
  47. const char *metric,
  48. const char *symbol);
  49. /**
  50. * Add action for specified metric
  51. * @param cfg config file object
  52. * @param metric metric's name
  53. * @param action action's name
  54. * @param value value of symbol
  55. * @return
  56. */
  57. gboolean add_dynamic_action(struct rspamd_config *cfg,
  58. const char *metric,
  59. unsigned int action,
  60. double value);
  61. /**
  62. * Removes dynamic action
  63. */
  64. gboolean remove_dynamic_action(struct rspamd_config *cfg,
  65. const char *metric,
  66. unsigned int action);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* DYNAMIC_CFG_H_ */