spf_record.h File Reference

#include "spf_response.h"
#include "spf_request.h"
#include "spf_server.h"

Include dependency graph for spf_record.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SPF_data_str_t
struct  SPF_data_var_t
struct  SPF_data_cidr_t
union  SPF_data_t
struct  SPF_mech_t
struct  SPF_mod_t
struct  SPF_record_struct
struct  SPF_macro_struct

Defines

#define SPF_MAX_STR_LEN   255
#define SPF_MAX_MECH_LEN   511
#define SPF_MAX_MOD_LEN   511
#define PARM_LP_FROM   0
#define PARM_ENV_FROM   1
#define PARM_DP_FROM   2
#define PARM_CUR_DOM   3
#define PARM_CLIENT_IP   4
#define PARM_CLIENT_IP_P   5
#define PARM_TIME   6
#define PARM_CLIENT_DOM   7
#define PARM_CLIENT_VER   8
#define PARM_HELO_DOM   9
#define PARM_REC_DOM   10
#define PARM_CIDR   11
#define PARM_STRING   12
#define PREFIX_PASS   SPF_RESULT_PASS
#define PREFIX_FAIL   SPF_RESULT_FAIL
#define PREFIX_SOFTFAIL   SPF_RESULT_SOFTFAIL
#define PREFIX_NEUTRAL   SPF_RESULT_NEUTRAL
#define PREFIX_UNKNOWN   SPF_RESULT_PERMERROR
#define MECH_UNKNOWN   0
#define MECH_A   1
#define MECH_MX   2
#define MECH_PTR   3
#define MECH_INCLUDE   4
#define MECH_IP4   5
#define MECH_IP6   6
#define MECH_EXISTS   7
#define MECH_ALL   8
#define MECH_REDIRECT   9

Typedefs

typedef struct SPF_record_struct SPF_record_t
typedef struct SPF_macro_struct SPF_macro_t

Functions

SPF_record_tSPF_record_new (SPF_server_t *spf_server, const char *text)
void SPF_record_free (SPF_record_t *rp)
void SPF_macro_free (SPF_macro_t *mac)
SPF_errcode_t SPF_record_find_mod_value (SPF_server_t *spf_server, SPF_request_t *spf_request, SPF_response_t *spf_response, SPF_record_t *spf_record, const char *mod_name, char **bufp, size_t *buflenp)
SPF_errcode_t SPF_record_compile (SPF_server_t *spf_server, SPF_response_t *spf_response, SPF_record_t **spf_recordp, const char *record)
SPF_errcode_t SPF_record_compile_macro (SPF_server_t *spf_server, SPF_response_t *spf_response, SPF_macro_t **spf_macrop, const char *record)
SPF_errcode_t SPF_record_interpret (SPF_record_t *spf_record, SPF_request_t *spf_request, SPF_response_t *spf_response, int depth)
SPF_errcode_t SPF_record_expand_data (SPF_server_t *spf_server, SPF_request_t *spf_request, SPF_response_t *spf_response, SPF_data_t *data, size_t data_len, char **bufp, size_t *buflenp)
SPF_errcode_t SPF_record_print (SPF_record_t *spf_record)
SPF_errcode_t SPF_record_stringify (SPF_record_t *spf_record, char **bufp, size_t *buflenp)


Detailed Description

Compiled SPF record

The compiled form of the SPF record is as follows:

* A four byte header which contains the version, and information about the mechanisms and modifiers

* Mechanism information, repeated once for each mechanism

* A two byte header describing the mechanism

* Data associated with the mechanism. This can be of several forms

* ip4/ip6 have a fixed format data field, cidr length is in the mechanism's parm_len field

* Mechanisms that allow a macro-string

* Optional two byte CIDR length structure. (Yes, this is at the beginning, rather than at the end.)

* tokenized data description blocks that can be either:

* two byte macro variable description

* two byte string description, followed by the string

* Modifier information, repeated once for each modifier

* two byte header describing the modifier

* name of the modifier

* tokenized data description blocks that can be either:

* two byte macro variable description

* two byte string description, followed by the string

Definition in file spf_record.h.


Define Documentation

#define MECH_A   1

Definition at line 163 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_ALL   8

Definition at line 170 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_EXISTS   7

Definition at line 169 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_INCLUDE   4

Definition at line 166 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_IP4   5

Definition at line 167 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_IP6   6

Definition at line 168 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_MX   2

Definition at line 164 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_PTR   3

Definition at line 165 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_REDIRECT   9

Definition at line 171 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define MECH_UNKNOWN   0

Mechanisms Return PERMERROR

Definition at line 162 of file spf_record.h.

#define PARM_CIDR   11

CIDR lengths (IPv4 and v6)

Definition at line 99 of file spf_record.h.

Referenced by SPF_record_expand_data(), and SPF_record_stringify().

#define PARM_CLIENT_DOM   7

p = SMTP client domain name

Definition at line 95 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_CLIENT_IP   4

i = SMTP client IP

Definition at line 92 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_CLIENT_IP_P   5

c = SMTP client IP (pretty)

Definition at line 93 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_CLIENT_VER   8

v = IP ver str - in-addr/ip6

Definition at line 96 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_CUR_DOM   3

d = current-domain

Definition at line 91 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_DP_FROM   2

o = envelope-domain

Definition at line 90 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_ENV_FROM   1

s = envelope-sender

Definition at line 89 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_HELO_DOM   9

h = HELO/EHLO domain

Definition at line 97 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_LP_FROM   0

Tokens and macros to be expanded in SPF_data_str_t in mech/mod l = local-part of envelope-sender

Definition at line 88 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_REC_DOM   10

r = receiving domain

Definition at line 98 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_STRING   12

literal string

Definition at line 100 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PARM_TIME   6

t = time in UTC epoch secs

Definition at line 94 of file spf_record.h.

Referenced by SPF_record_expand_data().

#define PREFIX_FAIL   SPF_RESULT_FAIL

Definition at line 154 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define PREFIX_NEUTRAL   SPF_RESULT_NEUTRAL

Definition at line 156 of file spf_record.h.

Referenced by SPF_record_compile(), and SPF_record_stringify().

#define PREFIX_PASS   SPF_RESULT_PASS

Prefixes

Definition at line 153 of file spf_record.h.

Referenced by SPF_record_compile(), and SPF_record_stringify().

#define PREFIX_SOFTFAIL   SPF_RESULT_SOFTFAIL

Definition at line 155 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define PREFIX_UNKNOWN   SPF_RESULT_PERMERROR

Definition at line 157 of file spf_record.h.

Referenced by SPF_record_compile(), SPF_record_interpret(), and SPF_record_stringify().

#define SPF_MAX_MECH_LEN   511

Definition at line 77 of file spf_record.h.

#define SPF_MAX_MOD_LEN   511

Definition at line 78 of file spf_record.h.

Referenced by SPF_record_compile_macro().

#define SPF_MAX_STR_LEN   255

Definition at line 73 of file spf_record.h.


Typedef Documentation

typedef struct SPF_macro_struct SPF_macro_t

Definition at line 23 of file spf_record.h.

Definition at line 22 of file spf_record.h.


Function Documentation

void SPF_macro_free ( SPF_macro_t mac  ) 

Definition at line 73 of file spf_record.c.

Referenced by SPF_request_get_exp(), SPF_server_free(), and SPF_server_set_explanation().

SPF_errcode_t SPF_record_compile ( SPF_server_t spf_server,
SPF_response_t spf_response,
SPF_record_t **  spf_recordp,
const char *  record 
)

SPF_errcode_t SPF_record_compile_macro ( SPF_server_t spf_server,
SPF_response_t spf_response,
SPF_macro_t **  spf_macrop,
const char *  record 
)

SPF_errcode_t SPF_record_expand_data ( SPF_server_t spf_server,
SPF_request_t spf_request,
SPF_response_t spf_response,
SPF_data_t data,
size_t  data_len,
char **  bufp,
size_t *  buflenp 
)

SPF_errcode_t SPF_record_find_mod_value ( SPF_server_t spf_server,
SPF_request_t spf_request,
SPF_response_t spf_response,
SPF_record_t spf_record,
const char *  mod_name,
char **  bufp,
size_t *  buflenp 
)

Definition at line 126 of file spf_record.c.

References SPF_ASSERT_NOTNULL, and SPF_record_expand_data().

Referenced by SPF_request_get_exp().

Here is the call graph for this function:

void SPF_record_free ( SPF_record_t rp  ) 

SPF_errcode_t SPF_record_interpret ( SPF_record_t spf_record,
SPF_request_t spf_request,
SPF_response_t spf_response,
int  depth 
)

In spf_interpret.c

Definition at line 585 of file spf_interpret.c.

References SPF_dns_rr_data_t::a, SPF_dns_rr_data_t::aaaa, SPF_request_struct::client_ver, SPF_request_struct::cur_dom, SPF_server_struct::debug, DONE, DONE_MECH, DONE_PERMERR, DONE_TEMPERR, FALSE, SPF_dns_rr_t::herrno, INET_NTOP, SPF_request_struct::ipv4, SPF_request_struct::ipv6, SPF_server_struct::local_policy, SPF_server_struct::max_dns_mech, SPF_server_struct::max_dns_mx, SPF_server_struct::max_dns_ptr, MECH_A, MECH_ALL, MECH_EXISTS, SPF_record_struct::mech_first, MECH_INCLUDE, MECH_IP4, MECH_IP6, MECH_MX, MECH_PTR, MECH_REDIRECT, SPF_mech_t::mech_type, SPF_dns_rr_data_t::mx, ns_t_a, ns_t_aaaa, ns_t_mx, ns_t_ptr, NULL, SPF_response_struct::num_dns_mech, SPF_record_struct::num_mech, SPF_dns_rr_t::num_rr, PREFIX_FAIL, PREFIX_SOFTFAIL, SPF_mech_t::prefix_type, PREFIX_UNKNOWN, SPF_dns_rr_data_t::ptr, SPF_response_struct::reason, SPF_server_struct::resolver, SPF_response_struct::result, SPF_dns_rr_t::rr, SPF_dns_rr_t::rr_type, SPF_ADD_DNS_MECH, SPF_ASSERT_NOTNULL, SPF_debugf, SPF_dns_lookup(), SPF_dns_rlookup(), SPF_dns_rlookup6(), SPF_dns_rr_free(), SPF_E_BIG_DNS, SPF_E_DNS_ERROR, SPF_E_INCLUDE_RETURNED_NONE, SPF_E_NO_MEMORY, SPF_E_NOT_CONFIG, SPF_E_RECURSIVE, SPF_E_SUCCESS, SPF_E_UNKNOWN_MECH, SPF_FREE_LOOKUP_DATA, SPF_GET_LOOKUP_DATA, SPF_MAYBE_SKIP_CIDR, SPF_REASON_DEFAULT, SPF_REASON_LOCALHOST, SPF_REASON_MECH, SPF_REASON_NONE, SPF_response_struct::spf_record_exp, SPF_record_expand_data(), SPF_record_free(), SPF_record_interpret(), SPF_request_is_loopback(), SPF_response_errcode(), SPF_response_free(), SPF_response_new(), SPF_response_result(), SPF_RESULT_FAIL, SPF_RESULT_INVALID, SPF_RESULT_NEUTRAL, SPF_RESULT_NONE, SPF_RESULT_PASS, SPF_RESULT_PERMERROR, SPF_RESULT_SOFTFAIL, SPF_RESULT_TEMPERROR, SPF_record_struct::spf_server, SPF_server_get_record(), SPF_strerror(), SPF_strreason(), SPF_strresult(), TRUE, TRY_AGAIN, and SPF_request_struct::use_local_policy.

Referenced by SPF_record_interpret().

Here is the call graph for this function:

SPF_record_t* SPF_record_new ( SPF_server_t spf_server,
const char *  text 
)

In spf_record.c

Definition at line 48 of file spf_record.c.

References SPF_record_struct::spf_server.

Referenced by SPF_record_compile().

SPF_errcode_t SPF_record_print ( SPF_record_t spf_record  ) 

SPF_errcode_t SPF_record_stringify ( SPF_record_t spf_record,
char **  bufp,
size_t *  buflenp 
)


Generated on Sun May 29 13:28:45 2016 for libspf2 by  doxygen 1.5.5