Data Structures | Defines | Functions

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_t
struct  SPF_macro_t

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

Functions

SPF_record_t * SPF_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_interpret(), and SPF_record_stringify().

#define PREFIX_NEUTRAL   SPF_RESULT_NEUTRAL

Definition at line 156 of file spf_record.h.

Referenced by SPF_record_stringify().

#define PREFIX_PASS   SPF_RESULT_PASS

Prefixes

Definition at line 153 of file spf_record.h.

Referenced by SPF_record_stringify().

#define PREFIX_SOFTFAIL   SPF_RESULT_SOFTFAIL

Definition at line 155 of file spf_record.h.

Referenced by 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 __attribute__(), and SPF_record_compile_macro().

#define SPF_MAX_STR_LEN   255

Definition at line 73 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 
)
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.

Referenced by SPF_record_compile().

SPF_errcode_t SPF_record_print ( SPF_record_t *  spf_record  ) 

In spf_print.c

Definition at line 45 of file spf_print.c.

References NULL, SPF_E_RESULT_UNKNOWN, SPF_info, SPF_infof, SPF_record_stringify(), and SPF_strerror().

Referenced by main().

Here is the call graph for this function:

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