aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_rcl.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-26 10:49:23 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-07-26 10:49:23 +0100
commit537a7180a0d5132c11636c4fd8b1450cd99d352c (patch)
treefb9f8c84955a411bdffbd6371ea32f2716fb3687 /src/libserver/cfg_rcl.h
parent5fd7a90fdaa33f52c59bdb0ca84451e5c1e22365 (diff)
downloadrspamd-537a7180a0d5132c11636c4fd8b1450cd99d352c.tar.gz
rspamd-537a7180a0d5132c11636c4fd8b1450cd99d352c.zip
[Rework] Use clang-format to unify formatting in all sources
No meaningful changes.
Diffstat (limited to 'src/libserver/cfg_rcl.h')
-rw-r--r--src/libserver/cfg_rcl.h318
1 files changed, 159 insertions, 159 deletions
diff --git a/src/libserver/cfg_rcl.h b/src/libserver/cfg_rcl.h
index d7777ccc7..6bbeda0e6 100644
--- a/src/libserver/cfg_rcl.h
+++ b/src/libserver/cfg_rcl.h
@@ -21,14 +21,14 @@
#include "ucl.h"
#include "mem_pool.h"
-#define CFG_RCL_ERROR cfg_rcl_error_quark ()
+#define CFG_RCL_ERROR cfg_rcl_error_quark()
static inline GQuark
-cfg_rcl_error_quark (void)
+cfg_rcl_error_quark(void)
{
- return g_quark_from_static_string ("cfg-rcl-error-quark");
+ return g_quark_from_static_string("cfg-rcl-error-quark");
}
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -71,18 +71,18 @@ struct rspamd_rcl_struct_parser {
* @param err error object
* @return TRUE if a section has been parsed
*/
-typedef gboolean (*rspamd_rcl_handler_t) (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- const gchar *key,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
-
-typedef gboolean (*rspamd_rcl_default_handler_t) (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+typedef gboolean (*rspamd_rcl_handler_t)(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ const gchar *key,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
+
+typedef gboolean (*rspamd_rcl_default_handler_t)(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* A handler type that is called at the end of section parsing
@@ -100,13 +100,13 @@ typedef void (*rspamd_rcl_section_fin_t)(rspamd_mempool_t *pool, gpointer ud);
* @param flags flags for the parser
* @return newly created structure
*/
-struct rspamd_rcl_default_handler_data *rspamd_rcl_add_default_handler (
- struct rspamd_rcl_section *section,
- const gchar *name,
- rspamd_rcl_default_handler_t handler,
- goffset offset,
- gint flags,
- const gchar *doc_string);
+struct rspamd_rcl_default_handler_data *rspamd_rcl_add_default_handler(
+ struct rspamd_rcl_section *section,
+ const gchar *name,
+ rspamd_rcl_default_handler_t handler,
+ goffset offset,
+ gint flags,
+ const gchar *doc_string);
/**
* Add new section to the configuration
@@ -119,27 +119,27 @@ struct rspamd_rcl_default_handler_data *rspamd_rcl_add_default_handler (
* @param strict_type turn on strict check for types for this section
* @return newly created structure
*/
-struct rspamd_rcl_section *rspamd_rcl_add_section (
- struct rspamd_rcl_section **top,
- const gchar *name, const gchar *key_attr,
- rspamd_rcl_handler_t handler,
- enum ucl_type type, gboolean required, gboolean strict_type);
-
-struct rspamd_rcl_section *rspamd_rcl_add_section_doc (
- struct rspamd_rcl_section **top,
- const gchar *name, const gchar *key_attr,
- rspamd_rcl_handler_t handler,
- enum ucl_type type, gboolean required,
- gboolean strict_type,
- ucl_object_t *doc_target,
- const gchar *doc_string);
+struct rspamd_rcl_section *rspamd_rcl_add_section(
+ struct rspamd_rcl_section **top,
+ const gchar *name, const gchar *key_attr,
+ rspamd_rcl_handler_t handler,
+ enum ucl_type type, gboolean required, gboolean strict_type);
+
+struct rspamd_rcl_section *rspamd_rcl_add_section_doc(
+ struct rspamd_rcl_section **top,
+ const gchar *name, const gchar *key_attr,
+ rspamd_rcl_handler_t handler,
+ enum ucl_type type, gboolean required,
+ gboolean strict_type,
+ ucl_object_t *doc_target,
+ const gchar *doc_string);
/**
* Init common sections known to rspamd
* @return top section
*/
-struct rspamd_rcl_section * rspamd_rcl_config_init (struct rspamd_config *cfg,
- GHashTable *skip_sections);
+struct rspamd_rcl_section *rspamd_rcl_config_init(struct rspamd_config *cfg,
+ GHashTable *skip_sections);
/**
* Get a section specified by path, it understand paths separated by '/' character
@@ -147,7 +147,7 @@ struct rspamd_rcl_section * rspamd_rcl_config_init (struct rspamd_config *cfg,
* @param path '/' divided path
* @return
*/
-struct rspamd_rcl_section * rspamd_rcl_config_get_section (
+struct rspamd_rcl_section *rspamd_rcl_config_get_section(
struct rspamd_rcl_section *top,
const char *path);
@@ -161,10 +161,10 @@ struct rspamd_rcl_section * rspamd_rcl_config_get_section (
* @param err error pointer
* @return
*/
-gboolean rspamd_rcl_parse (struct rspamd_rcl_section *top,
- struct rspamd_config *cfg,
- gpointer ptr, rspamd_mempool_t *pool,
- const ucl_object_t *obj, GError **err);
+gboolean rspamd_rcl_parse(struct rspamd_rcl_section *top,
+ struct rspamd_config *cfg,
+ gpointer ptr, rspamd_mempool_t *pool,
+ const ucl_object_t *obj, GError **err);
/**
@@ -176,10 +176,10 @@ gboolean rspamd_rcl_parse (struct rspamd_rcl_section *top,
* @param err error ptr
* @return TRUE if the object has been parsed
*/
-gboolean rspamd_rcl_section_parse_defaults (struct rspamd_config *cfg,
- struct rspamd_rcl_section *section,
- rspamd_mempool_t *pool, const ucl_object_t *obj, gpointer ptr,
- GError **err);
+gboolean rspamd_rcl_section_parse_defaults(struct rspamd_config *cfg,
+ struct rspamd_rcl_section *section,
+ rspamd_mempool_t *pool, const ucl_object_t *obj, gpointer ptr,
+ GError **err);
/**
* Here is a section of common handlers that accepts rcl_struct_parser
* which itself contains a struct pointer and the offset of a member in a
@@ -195,11 +195,11 @@ gboolean rspamd_rcl_section_parse_defaults (struct rspamd_config *cfg,
* @param err error pointer
* @return TRUE if a string value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_string(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse an integer field of a structure
@@ -210,11 +210,11 @@ gboolean rspamd_rcl_parse_struct_string (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_integer (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_integer(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
@@ -226,11 +226,11 @@ gboolean rspamd_rcl_parse_struct_integer (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_double (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_double(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a time field of a structure
@@ -241,11 +241,11 @@ gboolean rspamd_rcl_parse_struct_double (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_time (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_time(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a string list field of a structure presented by a GList* object
@@ -256,11 +256,11 @@ gboolean rspamd_rcl_parse_struct_time (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string_list (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_string_list(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a boolean field of a structure
@@ -271,11 +271,11 @@ gboolean rspamd_rcl_parse_struct_string_list (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_boolean (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_boolean(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a keypair field of a structure
@@ -286,11 +286,11 @@ gboolean rspamd_rcl_parse_struct_boolean (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_keypair (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_keypair(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a pubkey field of a structure
@@ -301,11 +301,11 @@ gboolean rspamd_rcl_parse_struct_keypair (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_pubkey (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_pubkey(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a inet addr field of a structure
@@ -316,11 +316,11 @@ gboolean rspamd_rcl_parse_struct_pubkey (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_addr (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_addr(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a gmime inet address field of a structure
@@ -331,11 +331,11 @@ gboolean rspamd_rcl_parse_struct_addr (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_mime_addr (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_mime_addr(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
* Parse a raw ucl object
@@ -346,11 +346,11 @@ gboolean rspamd_rcl_parse_struct_mime_addr (rspamd_mempool_t *pool,
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_ucl (rspamd_mempool_t *pool,
- const ucl_object_t *obj,
- gpointer ud,
- struct rspamd_rcl_section *section,
- GError **err);
+gboolean rspamd_rcl_parse_struct_ucl(rspamd_mempool_t *pool,
+ const ucl_object_t *obj,
+ gpointer ud,
+ struct rspamd_rcl_section *section,
+ GError **err);
/**
@@ -366,14 +366,14 @@ gboolean rspamd_rcl_parse_struct_ucl (rspamd_mempool_t *pool,
* @param target opaque target structure, note it **MUST** be worker ctx due to some reasons I don't really remember
* @param offset offset inside a structure
*/
-void rspamd_rcl_register_worker_option (struct rspamd_config *cfg,
- GQuark type,
- const gchar *name,
- rspamd_rcl_default_handler_t handler,
- gpointer target,
- glong offset,
- gint flags,
- const gchar *doc_string);
+void rspamd_rcl_register_worker_option(struct rspamd_config *cfg,
+ GQuark type,
+ const gchar *name,
+ rspamd_rcl_default_handler_t handler,
+ gpointer target,
+ glong offset,
+ gint flags,
+ const gchar *doc_string);
/**
* Register a default parser for a worker
@@ -382,36 +382,36 @@ void rspamd_rcl_register_worker_option (struct rspamd_config *cfg,
* @param func handler function
* @param ud userdata for handler function
*/
-void rspamd_rcl_register_worker_parser (struct rspamd_config *cfg, gint type,
- gboolean (*func)(ucl_object_t *, gpointer), gpointer ud);
+void rspamd_rcl_register_worker_parser(struct rspamd_config *cfg, gint type,
+ gboolean (*func)(ucl_object_t *, gpointer), gpointer ud);
/**
* Adds new documentation object to the configuration
* @param doc_target target object where to insert documentation (top object is used if this is NULL)
* @param doc_object documentation object to insert
*/
-ucl_object_t *rspamd_rcl_add_doc_obj (ucl_object_t *doc_target,
- const char *doc_string,
- const char *doc_name,
- ucl_type_t type,
- rspamd_rcl_default_handler_t handler,
- gint flags,
- const char *default_value,
- gboolean required);
+ucl_object_t *rspamd_rcl_add_doc_obj(ucl_object_t *doc_target,
+ const char *doc_string,
+ const char *doc_name,
+ ucl_type_t type,
+ rspamd_rcl_default_handler_t handler,
+ gint flags,
+ const char *default_value,
+ gboolean required);
/**
* Adds new documentation option specified by path `doc_path` that should be
* split by dots
*/
-ucl_object_t *rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
- const gchar *doc_path,
- const char *doc_string,
- const char *doc_name,
- ucl_type_t type,
- rspamd_rcl_default_handler_t handler,
- gint flags,
- const char *default_value,
- gboolean required);
+ucl_object_t *rspamd_rcl_add_doc_by_path(struct rspamd_config *cfg,
+ const gchar *doc_path,
+ const char *doc_string,
+ const char *doc_name,
+ ucl_type_t type,
+ rspamd_rcl_default_handler_t handler,
+ gint flags,
+ const char *default_value,
+ gboolean required);
/**
@@ -435,11 +435,11 @@ ucl_object_t *rspamd_rcl_add_doc_by_path (struct rspamd_config *cfg,
* @param example_len
* @return
*/
-ucl_object_t *rspamd_rcl_add_doc_by_example (struct rspamd_config *cfg,
- const gchar *root_path,
- const gchar *doc_string,
- const gchar *doc_name,
- const gchar *example_data, gsize example_len);
+ucl_object_t *rspamd_rcl_add_doc_by_example(struct rspamd_config *cfg,
+ const gchar *root_path,
+ const gchar *doc_string,
+ const gchar *doc_name,
+ const gchar *example_data, gsize example_len);
/**
* Add lua modules path
@@ -448,11 +448,11 @@ ucl_object_t *rspamd_rcl_add_doc_by_example (struct rspamd_config *cfg,
* @param err
* @return
*/
-gboolean rspamd_rcl_add_lua_plugins_path (struct rspamd_config *cfg,
- const gchar *path,
- gboolean main_path,
- GHashTable *modules_seen,
- GError **err);
+gboolean rspamd_rcl_add_lua_plugins_path(struct rspamd_config *cfg,
+ const gchar *path,
+ gboolean main_path,
+ GHashTable *modules_seen,
+ GError **err);
/**
@@ -474,30 +474,30 @@ gboolean rspamd_rcl_add_lua_plugins_path (struct rspamd_config *cfg,
* it is changed, then rcl_obj is imported from lua. Old config is dereferenced.
* @param cfg
*/
-void rspamd_rcl_maybe_apply_lua_transform (struct rspamd_config *cfg);
-void rspamd_rcl_section_free (gpointer p);
+void rspamd_rcl_maybe_apply_lua_transform(struct rspamd_config *cfg);
+void rspamd_rcl_section_free(gpointer p);
-void rspamd_config_calculate_cksum (struct rspamd_config *cfg);
+void rspamd_config_calculate_cksum(struct rspamd_config *cfg);
/*
* Read configuration file
*/
-gboolean rspamd_config_parse_ucl (struct rspamd_config *cfg,
- const gchar *filename,
- GHashTable *vars,
- ucl_include_trace_func_t inc_trace,
- void *trace_data,
- gboolean skip_jinja,
- GError **err);
-gboolean rspamd_config_read (struct rspamd_config *cfg,
- const gchar *filename,
- rspamd_rcl_section_fin_t logger_fin,
- gpointer logger_ud,
- GHashTable *vars,
- gboolean skip_jinja,
- gchar **lua_env);
-
-#ifdef __cplusplus
+gboolean rspamd_config_parse_ucl(struct rspamd_config *cfg,
+ const gchar *filename,
+ GHashTable *vars,
+ ucl_include_trace_func_t inc_trace,
+ void *trace_data,
+ gboolean skip_jinja,
+ GError **err);
+gboolean rspamd_config_read(struct rspamd_config *cfg,
+ const gchar *filename,
+ rspamd_rcl_section_fin_t logger_fin,
+ gpointer logger_ud,
+ GHashTable *vars,
+ gboolean skip_jinja,
+ gchar **lua_env);
+
+#ifdef __cplusplus
}
#endif