diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 16:25:51 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 16:25:51 +0100 |
commit | 61555065f3d1c8badcc9573691232f1b6e42988c (patch) | |
tree | 563d5b7cb8c468530f7e79c4da0a75267b1184e1 /src/libserver/spf.h | |
parent | ad5bf825b7f33bc10311673991f0cc888e69c0b1 (diff) | |
download | rspamd-61555065f3d1c8badcc9573691232f1b6e42988c.tar.gz rspamd-61555065f3d1c8badcc9573691232f1b6e42988c.zip |
Rework project structure, remove trash files.
Diffstat (limited to 'src/libserver/spf.h')
-rw-r--r-- | src/libserver/spf.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/libserver/spf.h b/src/libserver/spf.h new file mode 100644 index 000000000..94c613e42 --- /dev/null +++ b/src/libserver/spf.h @@ -0,0 +1,84 @@ +#ifndef RSPAMD_SPF_H +#define RSPAMD_SPF_H + +#include "config.h" + +struct rspamd_task; +struct spf_record; + +typedef void (*spf_cb_t)(struct spf_record *record, struct rspamd_task *task); + +typedef enum spf_mech_e { + SPF_FAIL, + SPF_SOFT_FAIL, + SPF_PASS, + SPF_NEUTRAL +} spf_mech_t; + +typedef enum spf_action_e { + SPF_RESOLVE_MX, + SPF_RESOLVE_A, + SPF_RESOLVE_PTR, + SPF_RESOLVE_AAA, + SPF_RESOLVE_REDIRECT, + SPF_RESOLVE_INCLUDE, + SPF_RESOLVE_EXISTS, + SPF_RESOLVE_EXP +} spf_action_t; + +struct spf_addr { + union { + struct { + union { + struct in_addr in4; +#ifdef HAVE_INET_PTON + struct in6_addr in6; +#endif + } d; + guint32 mask; + gboolean ipv6; + gboolean parsed; + gboolean addr_any; + } normal; + GList *list; + } data; + gboolean is_list; + spf_mech_t mech; + gchar *spf_string; +}; + +struct spf_record { + gchar **elts; + + gchar *cur_elt; + gint elt_num; + gint nested; + gint dns_requests; + gint requests_inflight; + + guint ttl; + + GList *addrs; + gchar *cur_domain; + gchar *sender; + gchar *sender_domain; + gchar *local_part; + struct rspamd_task *task; + spf_cb_t callback; + + gboolean in_include; +}; + + +/* + * Resolve spf record for specified task and call a callback after resolution fails/succeed + */ +gboolean resolve_spf (struct rspamd_task *task, spf_cb_t callback); + +/* + * Get a domain for spf for specified task + */ +gchar *get_spf_domain (struct rspamd_task *task); + + +#endif |