diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-08 15:22:05 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-07-08 15:22:05 +0100 |
commit | c271eb36656a4ff88a9c8c1d59934949260275a3 (patch) | |
tree | 3dd586e38b5b37cfebc7c12b6ff6f434904167c7 /src/libutil/expression.h | |
parent | b266445f47dec06392a7e058f499325fa3c052b9 (diff) | |
download | rspamd-c271eb36656a4ff88a9c8c1d59934949260275a3.tar.gz rspamd-c271eb36656a4ff88a9c8c1d59934949260275a3.zip |
[Rework] Add C++ guards to all headers
Diffstat (limited to 'src/libutil/expression.h')
-rw-r--r-- | src/libutil/expression.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/libutil/expression.h b/src/libutil/expression.h index bd336b87b..bd18fa75f 100644 --- a/src/libutil/expression.h +++ b/src/libutil/expression.h @@ -20,6 +20,10 @@ #include "mem_pool.h" #include "fstring.h" +#ifdef __cplusplus +extern "C" { +#endif + #define RSPAMD_EXPRESSION_MAX_PRIORITY 1024 #define RSPAMD_EXPRESSION_FLAG_NOOPT (1 << 0) @@ -56,17 +60,20 @@ typedef struct rspamd_expression_atom_s { gint priority; } rspamd_expression_atom_t; -typedef gdouble (*rspamd_expression_process_cb)(gpointer runtime_data, - rspamd_expression_atom_t *atom); +typedef gdouble (*rspamd_expression_process_cb) (gpointer runtime_data, + rspamd_expression_atom_t *atom); struct rspamd_atom_subr { /* Parses atom from string and returns atom structure */ - rspamd_expression_atom_t * (*parse)(const gchar *line, gsize len, - rspamd_mempool_t *pool, gpointer ud, GError **err); + rspamd_expression_atom_t *(*parse) (const gchar *line, gsize len, + rspamd_mempool_t *pool, gpointer ud, GError **err); + /* Process atom via the opaque pointer (e.g. struct rspamd_task *) */ rspamd_expression_process_cb process; + /* Calculates the relative priority of the expression */ gint (*priority) (rspamd_expression_atom_t *atom); + void (*destroy) (rspamd_expression_atom_t *atom); }; @@ -85,9 +92,9 @@ struct rspamd_expression; * @return TRUE if an expression have been parsed */ gboolean rspamd_parse_expression (const gchar *line, gsize len, - const struct rspamd_atom_subr *subr, gpointer subr_data, - rspamd_mempool_t *pool, GError **err, - struct rspamd_expression **target); + const struct rspamd_atom_subr *subr, gpointer subr_data, + rspamd_mempool_t *pool, GError **err, + struct rspamd_expression **target); /** * Process the expression and return its value using atom 'process' functions with the specified data pointer @@ -124,6 +131,7 @@ gdouble rspamd_process_expression_closure (struct rspamd_expression *expr, gint flags, gpointer runtime_ud, GPtrArray **track); + /** * Shows string representation of an expression * @param expr expression to show @@ -136,7 +144,7 @@ GString *rspamd_expression_tostring (struct rspamd_expression *expr); * and should not be modified within callback */ typedef void (*rspamd_expression_atom_foreach_cb) (const rspamd_ftok_t *atom, - gpointer ud); + gpointer ud); /** * Traverse over all atoms in the expression @@ -145,7 +153,7 @@ typedef void (*rspamd_expression_atom_foreach_cb) (const rspamd_ftok_t *atom, * @param ud opaque data passed to `cb` */ void rspamd_expression_atom_foreach (struct rspamd_expression *expr, - rspamd_expression_atom_foreach_cb cb, gpointer cbdata); + rspamd_expression_atom_foreach_cb cb, gpointer cbdata); /** * Checks if a specified node in AST is the specified operation @@ -155,4 +163,8 @@ void rspamd_expression_atom_foreach (struct rspamd_expression *expr, */ gboolean rspamd_expression_node_is_op (GNode *node, enum rspamd_expression_op op); +#ifdef __cplusplus +} +#endif + #endif /* SRC_LIBUTIL_EXPRESSION_H_ */ |