aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_headers.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-02-23 15:23:11 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-02-23 15:23:11 +0000
commit0befc8068f59f4e2c34811fdb898b6ff21da3fd4 (patch)
tree48ce982fd5c7967ff20e8839add0d48d87713222 /src/libmime/mime_headers.h
parent9fc6a2d181d9f9783ef6c11e6d935f6b88ac22a9 (diff)
downloadrspamd-0befc8068f59f4e2c34811fdb898b6ff21da3fd4.tar.gz
rspamd-0befc8068f59f4e2c34811fdb898b6ff21da3fd4.zip
[Project] Start headers modification API structure
Diffstat (limited to 'src/libmime/mime_headers.h')
-rw-r--r--src/libmime/mime_headers.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libmime/mime_headers.h b/src/libmime/mime_headers.h
index 56e29e9f9..f01a8b649 100644
--- a/src/libmime/mime_headers.h
+++ b/src/libmime/mime_headers.h
@@ -20,6 +20,7 @@
#include "libutil/mem_pool.h"
#include "libutil/addr.h"
#include "khash.h"
+#include "contrib/libucl/ucl.h"
#ifdef __cplusplus
extern "C" {
@@ -48,6 +49,9 @@ enum rspamd_mime_header_flags {
RSPAMD_HEADER_UNIQUE = 1u << 12u,
RSPAMD_HEADER_EMPTY_SEPARATOR = 1u << 13u,
RSPAMD_HEADER_TAB_SEPARATED = 1u << 14u,
+ RSPAMD_HEADER_MODIFIED = 1u << 15u, /* Means we need to check modified chain */
+ RSPAMD_HEADER_ADDED = 1u << 16u, /* A header has been artificially added */
+ RSPAMD_HEADER_REMOVED = 1u << 17u, /* A header has been artificially removed */
};
struct rspamd_mime_header {
@@ -60,6 +64,7 @@ struct rspamd_mime_header {
gchar *value;
gchar *separator;
gchar *decoded;
+ struct rspamd_mime_header *modified_chain; /* Headers modified during transform */
struct rspamd_mime_header *prev, *next; /* Headers with the same name */
struct rspamd_mime_header *ord_next; /* Overall order of headers, slist */
};
@@ -172,6 +177,19 @@ rspamd_message_get_header_from_hash (struct rspamd_mime_headers_table *hdrs,
const gchar *field);
/**
+ * Modifies a header (or insert one if not found)
+ * @param hdrs
+ * @param hdr_name
+ * @param obj an array of modified values
+ *
+ */
+void
+rspamd_message_set_modified_header (struct rspamd_task *task,
+ struct rspamd_mime_headers_table *hdrs,
+ const gchar *hdr_name,
+ const ucl_object_t *obj);
+
+/**
* Cleans up hash table of the headers
* @param htb
*/