spf.h File Reference

#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

Include dependency graph for spf.h:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  spf_result_t
struct  policy_addr_s
struct  spf_config_s
struct  strbuf_node_s
struct  strbuf_s
struct  split_str_node_s
struct  split_str_s
struct  peer_info_s

Defines

#define _SPF_H   1
#define SPF_VERSION   1
#define SPF_MAX_CNAME   5
#define SPF_MAX_DEBUG   2048
#define SPF_MAX_MACRO   1024
#define SPF_MAX_STR   4096
#define SPF_MAX_DELIM   255
#define SPF_MAX_LOCAL_PART   256
#define SPF_MAX_ENV_SENDER   512
#define SPF_MAX_CUR_DOM   256
#define SPF_MAX_UTC_TIME   22
#define SPF_MAX_IP_ADDR   17
#define SPF_MAX_IP_VER   8
#define SPF_MAX_ENV_HELO   512
#define SPF_MAX_HNAME   256
#define SPF_MAX_RESULT   64
#define SPF_MAX_ERROR   96
#define SPF_MAX_EXPLAIN_S   256
#define SPF_MAX_ENV_RECV   512
#define SPF_MAX_RES_STR   12
#define SPF_MAX_MECHANISM   256
#define SPF_MAX_HEADER   512
#define SPF_MAX_SMTP_RES   256
#define HR_RFC2822   "Received-SPF: "
#define HR_PASS   "pass"
#define HR_NONE   "none"
#define HR_S_FAIL   "softfail"
#define HR_H_FAIL   "fail"
#define HR_ERROR   "error"
#define HR_NEUTRAL   "neutral"
#define HR_UNKNOWN   "unknown"
#define HR_UNMECH   "unknown mechanism"
#define SPF_EXPLAIN
#define SPF_GUESS   "v=spf1 a/24 mx/24 ptr "
#define SPF_TRUSTED   "v=spf1 include:spf.trusted-forwarder.org "

Typedefs

typedef enum SPF_BOOL SPF_BOOL
typedef enum SPF_RESULT SPF_RESULT
typedef enum SPF_ACTION SPF_ACTION
typedef enum SPF_MECHANISM SPF_MECHANISM
typedef spf_result_t spf_result_t
typedef policy_addr_s policy_addr_t
typedef spf_config_s spf_config_t
typedef strbuf_node_s strbuf_node_t
typedef strbuf_s strbuf_t
typedef split_str_node_s split_str_node_t
typedef split_str_s split_str_t
typedef peer_info_s peer_info_t

Enumerations

enum  SPF_BOOL { SPF_FALSE = 0, SPF_TRUE }
enum  SPF_RESULT {
  SPF_PASS = 0, SPF_NONE, SPF_S_FAIL, SPF_H_FAIL,
  SPF_ERROR, SPF_NEUTRAL, SPF_UNKNOWN, SPF_UNMECH
}
enum  SPF_ACTION { DEFER = 0, TARPIT, ALLOW, REJECT }
enum  SPF_MECHANISM {
  NO_POLICY = 0, VERSION, ALL, INCLUDE,
  A, MX, PTR, IP4,
  IP6, EXISTS, REDIRECT, EXPLAIN,
  DEFAULT, UNMECH
}

Functions

peer_info_tSPF_init (const char *, const char *, const char *, const char *, const char *, u_int32_t, u_int32_t)
peer_info_tSPF_close (peer_info_t *)
SPF_RESULT SPF_policy_main (peer_info_t *)
SPF_RESULT SPF_policy_main_rec (peer_info_t *)
SPF_BOOL SPF_parse_policy (peer_info_t *, const char *)
char * SPF_result (peer_info_t *)
SPF_BOOL SPF_smtp_from (peer_info_t *, const char *)
SPF_BOOL SPF_smtp_helo (peer_info_t *, const char *)
char * SPF_build_header (peer_info_t *)
char * SPF_get_explain (peer_info_t *)

Variables

spf_config_t confg
u_int8_t spf_rlevel


Define Documentation

#define _SPF_H   1
 

Definition at line 47 of file spf.h.

#define HR_ERROR   "error"
 

Definition at line 100 of file spf.h.

Referenced by SPF_init().

#define HR_H_FAIL   "fail"
 

Definition at line 99 of file spf.h.

Referenced by SPF_init().

#define HR_NEUTRAL   "neutral"
 

Definition at line 101 of file spf.h.

Referenced by SPF_init().

#define HR_NONE   "none"
 

Definition at line 97 of file spf.h.

Referenced by SPF_init().

#define HR_PASS   "pass"
 

Definition at line 96 of file spf.h.

Referenced by SPF_init().

#define HR_RFC2822   "Received-SPF: "
 

Definition at line 95 of file spf.h.

#define HR_S_FAIL   "softfail"
 

Definition at line 98 of file spf.h.

Referenced by SPF_init().

#define HR_UNKNOWN   "unknown"
 

Definition at line 102 of file spf.h.

Referenced by SPF_init().

#define HR_UNMECH   "unknown mechanism"
 

Definition at line 103 of file spf.h.

Referenced by SPF_init().

#define SPF_EXPLAIN
 

Value:

"See http://spf.pobox.com/why.html?sender=%{S}&" \ "ip=%{I}&receiver=%{xR}"
Definition at line 106 of file spf.h.

Referenced by SPF_get_explain().

#define SPF_GUESS   "v=spf1 a/24 mx/24 ptr "
 

Definition at line 110 of file spf.h.

Referenced by SPF_init().

#define SPF_MAX_CNAME   5
 

Definition at line 69 of file spf.h.

#define SPF_MAX_CUR_DOM   256
 

Definition at line 77 of file spf.h.

#define SPF_MAX_DEBUG   2048
 

Definition at line 70 of file spf.h.

Referenced by _pprintf_dbg(), _printf_dbg(), and UTIL_log_result().

#define SPF_MAX_DELIM   255
 

Definition at line 73 of file spf.h.

Referenced by UTIL_count_delim().

#define SPF_MAX_ENV_HELO   512
 

Definition at line 81 of file spf.h.

Referenced by MACRO_process(), and SPF_smtp_from().

#define SPF_MAX_ENV_RECV   512
 

Definition at line 87 of file spf.h.

#define SPF_MAX_ENV_SENDER   512
 

Definition at line 76 of file spf.h.

#define SPF_MAX_ERROR   96
 

Definition at line 85 of file spf.h.

Referenced by DNS_query(), SPF_parse_policy(), and UTIL_assoc_prefix().

#define SPF_MAX_EXPLAIN_S   256
 

Definition at line 86 of file spf.h.

#define SPF_MAX_HEADER   512
 

Definition at line 91 of file spf.h.

Referenced by SPF_build_header(), and SPF_result().

#define SPF_MAX_HNAME   256
 

Definition at line 83 of file spf.h.

Referenced by MACRO_process(), UTIL_a_cmp(), UTIL_get_mech_prefix(), UTIL_ptr_cmp(), and UTIL_validate_ptr().

#define SPF_MAX_IP_ADDR   17
 

Definition at line 79 of file spf.h.

Referenced by MACRO_process(), SPF_init(), UTIL_cidr_cmp(), and UTIL_validate_hostname().

#define SPF_MAX_IP_VER   8
 

Definition at line 80 of file spf.h.

#define SPF_MAX_LOCAL_PART   256
 

Definition at line 75 of file spf.h.

Referenced by MACRO_process(), SPF_init(), and SPF_smtp_from().

#define SPF_MAX_MACRO   1024
 

Definition at line 71 of file spf.h.

Referenced by MACRO_eatmore().

#define SPF_MAX_MECHANISM   256
 

Definition at line 90 of file spf.h.

Referenced by SPF_parse_policy().

#define SPF_MAX_RES_STR   12
 

Definition at line 88 of file spf.h.

#define SPF_MAX_RESULT   64
 

Definition at line 84 of file spf.h.

#define SPF_MAX_SMTP_RES   256
 

Definition at line 92 of file spf.h.

Referenced by SPF_result().

#define SPF_MAX_STR   4096
 

Definition at line 72 of file spf.h.

Referenced by DNS_txt_answer(), MACRO_process(), SPF_parse_policy(), SPF_smtp_from(), and UTIL_split_str().

#define SPF_MAX_UTC_TIME   22
 

Definition at line 78 of file spf.h.

Referenced by MACRO_process().

#define SPF_TRUSTED   "v=spf1 include:spf.trusted-forwarder.org "
 

Definition at line 113 of file spf.h.

Referenced by SPF_init().

#define SPF_VERSION   1
 

Definition at line 57 of file spf.h.

Referenced by SPF_parse_policy(), and UTIL_log_result().


Typedef Documentation

typedef struct peer_info_s peer_info_t
 

Referenced by _SPF_clear_holdbufs(), DNS_check_client_reverse(), DNS_ptr_answer(), DNS_query(), MACRO_expand(), MACRO_process(), SPF_build_header(), SPF_close(), SPF_get_explain(), SPF_init(), SPF_parse_policy(), SPF_policy_main(), SPF_policy_main_rec(), SPF_result(), SPF_smtp_from(), SPF_smtp_helo(), UTIL_a_cmp(), UTIL_assoc_prefix(), UTIL_get_mech_prefix(), UTIL_log_result(), UTIL_mx_cmp(), UTIL_ptr_cmp(), UTIL_validate_hostname(), and UTIL_validate_ptr().

typedef struct policy_addr_s policy_addr_t
 

Referenced by SPF_parse_policy(), UTIL_a_cmp(), UTIL_cidr_cmp(), UTIL_expand_ip(), and UTIL_validate_hostname().

typedef enum SPF_ACTION SPF_ACTION
 

typedef enum SPF_BOOL SPF_BOOL
 

Referenced by _SPF_clear_holdbufs(), _UTIL_pthread_mutex(), DNS_check_client_reverse(), DNS_ptr_answer(), MACRO_addbuf(), SPF_parse_policy(), SPF_smtp_from(), SPF_smtp_helo(), UTIL_a_cmp(), UTIL_addnode(), UTIL_assoc_prefix(), UTIL_cidr_cmp(), UTIL_is_ip(), UTIL_is_macro(), UTIL_is_spf_delim(), UTIL_is_spf_result(), UTIL_mx_cmp(), UTIL_ptr_cmp(), UTIL_validate_hostname(), and UTIL_validate_ptr().

typedef struct spf_config_s spf_config_t
 

typedef enum SPF_MECHANISM SPF_MECHANISM
 

Referenced by SPF_parse_policy(), and UTIL_get_policy_mech().

typedef enum SPF_RESULT SPF_RESULT
 

Referenced by SPF_parse_policy(), SPF_policy_main(), SPF_policy_main_rec(), UTIL_assoc_prefix(), and UTIL_get_mech_prefix().

typedef struct spf_result_t spf_result_t
 

typedef struct split_str_node_s split_str_node_t
 

Referenced by UTIL_addnode(), and UTIL_reverse().

typedef struct split_str_s split_str_t
 

Referenced by UTIL_addnode(), and UTIL_reverse().

typedef struct strbuf_node_s strbuf_node_t
 

Referenced by MACRO_addbuf(), and MACRO_expand().

typedef struct strbuf_s strbuf_t
 

Referenced by MACRO_addbuf(), and MACRO_expand().


Enumeration Type Documentation

enum SPF_ACTION
 

Enumeration values:
DEFER 
TARPIT 
ALLOW 
REJECT 
Definition at line 171 of file spf.h.

enum SPF_BOOL
 

Enumeration values:
SPF_FALSE 
SPF_TRUE 
Definition at line 131 of file spf.h.

enum SPF_MECHANISM
 

Enumeration values:
NO_POLICY 
VERSION 
ALL 
INCLUDE 
A 
MX 
PTR 
IP4 
IP6 
EXISTS 
REDIRECT 
EXPLAIN 
DEFAULT 
UNMECH 
Definition at line 187 of file spf.h.

enum SPF_RESULT
 

Enumeration values:
SPF_PASS 
SPF_NONE 
SPF_S_FAIL 
SPF_H_FAIL 
SPF_ERROR 
SPF_NEUTRAL 
SPF_UNKNOWN 
SPF_UNMECH 
Definition at line 151 of file spf.h.


Function Documentation

char* SPF_build_header peer_info_t  ) 
 

Definition at line 1342 of file main.c.

References peer_info_s::current_domain, peer_info_s::error, peer_info_s::from, peer_info_s::last_m, peer_info_s::mta_hname, peer_info_t, peer_info_s::r_ip, peer_info_s::RES, SPF_ERROR, SPF_H_FAIL, SPF_MAX_HEADER, SPF_NEUTRAL, SPF_NONE, SPF_PASS, peer_info_s::spf_result, SPF_S_FAIL, SPF_UNKNOWN, SPF_UNMECH, xmalloc, and xvprintf.

peer_info_t* SPF_close peer_info_t  ) 
 

Definition at line 313 of file main.c.

References peer_info_s::cur_eaddr, peer_info_s::current_domain, peer_info_s::explain, peer_info_s::from, peer_info_s::guess, peer_info_s::helo, peer_info_s::mta_hname, peer_info_t, peer_info_s::ptr_mhost, peer_info_s::r_ip, peer_info_s::r_vhname, peer_info_s::trusted, xepprintf, and xfree.

Referenced by SPF_init().

char* SPF_get_explain peer_info_t  ) 
 

Definition at line 1310 of file main.c.

References peer_info_s::explain, MACRO_expand(), peer_info_t, SPF_EXPLAIN, and xprintf.

Here is the call graph for this function:

peer_info_t* SPF_init const char *  ,
const char *  ,
const char *  ,
const char *  ,
const char *  ,
u_int32_t  ,
u_int32_t 
 

Definition at line 81 of file main.c.

References peer_info_s::addr, peer_info_s::ALL, peer_info_s::cur_eaddr, peer_info_s::current_domain, peer_info_s::ehlo, peer_info_s::explain, peer_info_s::from, peer_info_s::guess, HDR_ERROR, HDR_H_FAIL, HDR_NEUTRAL, HDR_NONE, HDR_PASS, HDR_S_FAIL, HDR_UNKNOWN, HDR_UNMECH, peer_info_s::helo, HR_ERROR, HR_H_FAIL, HR_NEUTRAL, HR_NONE, HR_PASS, HR_S_FAIL, HR_UNKNOWN, HR_UNMECH, peer_info_s::ip_ver, peer_info_s::mta_hname, peer_info_s::p, peer_info_t, peer_info_s::ptr_mhost, peer_info_s::r_ip, peer_info_s::r_vhname, SIZEOF, SPF_close(), SPF_ERROR, SPF_FALSE, SPF_GUESS, SPF_H_FAIL, SPF_MAX_DATETIME, SPF_MAX_IP_ADDR, SPF_MAX_LOCAL_PART, SPF_NEUTRAL, SPF_NONE, SPF_PASS, peer_info_s::spf_result, peer_info_s::spf_rlevel, SPF_S_FAIL, SPF_TRUE, SPF_TRUSTED, SPF_UNKNOWN, SPF_UNMECH, peer_info_s::spf_ver, peer_info_s::trusted, peer_info_s::use_guess, peer_info_s::use_trust, peer_info_s::utc_time, UTIL_assoc_prefix(), xepprintf, xfree, xmalloc, xprintf, xstrndup, and xvprintf.

Here is the call graph for this function:

SPF_BOOL SPF_parse_policy peer_info_t ,
const char * 
 

Definition at line 721 of file main.c.

References A, peer_info_s::addr, policy_addr_s::addr, peer_info_s::ALL, ALL, peer_info_s::current_domain, DEFAULT, DNS_query(), peer_info_s::error, EXISTS, peer_info_s::explain, EXPLAIN, INCLUDE, peer_info_s::include_buf, IP4, IP6, peer_info_s::last_m, MACRO_expand(), MX, NO_POLICY, peer_info_t, policy_addr_t, PTR, peer_info_s::r_ip, REDIRECT, peer_info_s::redirect_buf, peer_info_s::RES, peer_info_s::RES_P, SPF_BOOL, SPF_FALSE, SPF_H_FAIL, SPF_MAX_ERROR, SPF_MAX_MECHANISM, SPF_MAX_RECURSE, SPF_MAX_STR, SPF_MECHANISM, SPF_NEUTRAL, SPF_NONE, SPF_PASS, peer_info_s::spf_result, SPF_RESULT, peer_info_s::spf_rlevel, SPF_S_FAIL, SPF_TRUE, SPF_UNKNOWN, SPF_UNMECH, peer_info_s::spf_ver, SPF_VERSION, UNMECH, UTIL_a_cmp(), UTIL_assoc_prefix(), UTIL_cidr_cmp(), UTIL_expand_ip(), UTIL_get_mech_prefix(), UTIL_get_policy_mech(), UTIL_index(), UTIL_is_macro(), UTIL_is_spf_result(), UTIL_mx_cmp(), UTIL_ptr_cmp(), VERSION, xepprintf, xfree, xpprintf, xprintf, xstrndup, and xvprintf.

Referenced by SPF_policy_main_rec().

Here is the call graph for this function:

SPF_RESULT SPF_policy_main peer_info_t  ) 
 

Definition at line 399 of file main.c.

References _SPF_clear_holdbufs(), peer_info_s::cname_buf, peer_info_s::current_domain, peer_info_s::include_buf, peer_info_t, peer_info_s::redirect_buf, SPF_MAX_RECURSE, SPF_NONE, SPF_PASS, SPF_policy_main_rec(), SPF_RESULT, peer_info_s::spf_rlevel, SPF_UNKNOWN, UTIL_assoc_prefix(), xepprintf, xpprintf, and xvprintf.

Here is the call graph for this function:

SPF_RESULT SPF_policy_main_rec peer_info_t  ) 
 

Definition at line 570 of file main.c.

References peer_info_s::addr, peer_info_s::cname_buf, peer_info_s::current_domain, DNS_query(), peer_info_s::guess, peer_info_s::include_buf, peer_info_s::last_m, peer_info_t, peer_info_s::redirect_buf, peer_info_s::RES, peer_info_s::rs, SPF_ERROR, SPF_NEUTRAL, SPF_parse_policy(), SPF_PASS, SPF_RESULT, SPF_TRUE, peer_info_s::trusted, peer_info_s::use_guess, peer_info_s::use_trust, UTIL_assoc_prefix(), UTIL_log_result(), xepprintf, xfree, xpprintf, xprintf, and xvprintf.

Referenced by SPF_policy_main().

Here is the call graph for this function:

char* SPF_result peer_info_t  ) 
 

Definition at line 1249 of file main.c.

References peer_info_s::from, peer_info_t, peer_info_s::r_ip, peer_info_s::RES, RES_ERROR, RES_H_FAIL, RES_NEUTRAL, RES_NONE, RES_PASS, RES_S_FAIL, RES_UNKNOWN, RES_UNMECH, SPF_ERROR, SPF_H_FAIL, SPF_MAX_HEADER, SPF_MAX_SMTP_RES, SPF_NEUTRAL, SPF_NONE, SPF_PASS, SPF_S_FAIL, SPF_UNKNOWN, SPF_UNMECH, xmalloc, and xprintf.

SPF_BOOL SPF_smtp_from peer_info_t ,
const char * 
 

Definition at line 1456 of file main.c.

References peer_info_s::current_domain, peer_info_s::from, peer_info_s::helo, peer_info_s::local_part, peer_info_t, SPF_BOOL, SPF_FALSE, SPF_MAX_ENV_HELO, SPF_MAX_LOCAL_PART, SPF_MAX_STR, SPF_TRUE, xfree, xprintf, xstrndup, and xvprintf.

SPF_BOOL SPF_smtp_helo peer_info_t ,
const char * 
 

Definition at line 1423 of file main.c.

References peer_info_s::ehlo, peer_info_s::helo, peer_info_t, SPF_BOOL, xfree, xprintf, and xstrdup.


Variable Documentation

spf_config_t confg
 

Definition at line 57 of file main.c.

Referenced by _pprintf_dbg(), and _printf_dbg().

u_int8_t spf_rlevel
 


Generated on Thu Sep 16 18:10:50 2004 for libSPF v1.0 by doxygen 1.3.8