util.c File Reference

#include "util.h"
#include "dns.h"

Go to the source code of this file.

Functions

void _printf_dbg (u_int8_t level, const char *function, const char *format,...)
void dummy_debug (const u_int8_t level, const char *function, const char *format,...)
char * UTIL_printf (char *format,...)
char * UTIL_get_date (void)
void UTIL_log_result (peer_info_t *peer_info)
char * UTIL_strndup (const char *s, const size_t n)
char * UTIL_strdup (const char *s)
void * UTIL_malloc (const int32_t n, const char *file, int32_t line, const char *func)
void * UTIL_realloc (void *p, const int32_t n, const char *file, const int32_t line, const char *func)
void UTIL_free (void *p, const char *file, const int32_t line, const char *func)
int16_t UTIL_index (const char *s, const char c)
char * UTIL_split_str (const char *s, const char c, const u_int8_t num)
char * UTIL_split_strr (const char *s, const char c, const u_int8_t num)
u_int8_t UTIL_count_delim (const char *s, const char c)
size_t UTIL_guess_whats_in_the_box (char *s, const char c, const u_int16_t num)
SPF_BOOL UTIL_is_spf_delim (const char c)
SPF_BOOL UTIL_is_spf_result (const char c)
SPF_BOOL UTIL_is_macro (const char *s)
SPF_BOOL UTIL_mx_cmp (peer_info_t *peer_info, const char *s, const int8_t cidr)
SPF_BOOL UTIL_a_cmp (peer_info_t *peer_info, const char *s, const int8_t cidr)
SPF_BOOL UTIL_ptr_cmp (peer_info_t *peer_info, const char *s)
SPF_MECHANISM UTIL_get_policy_mech (const char *s)
SPF_BOOL UTIL_assoc_prefix (peer_info_t *peer_info, SPF_RESULT p, const char *s)
SPF_RESULT UTIL_get_mech_prefix (peer_info_t *peer_info, const char *s)
policy_addr_tUTIL_expand_ip (const char *s)
SPF_BOOL UTIL_is_ip (const char *id)
char * UTIL_rev_addr (const char *s)
char * UTIL_get_dname (const char *s)
SPF_BOOL UTIL_cidr_cmp (peer_info_t *peer_info, const policy_addr_t *policy_addr, const struct in_addr *peer_addr)
SPF_BOOL UTIL_validate_ptr (peer_info_t *peer_info)
SPF_BOOL UTIL_validate_hostname (peer_info_t *peer_info, const char *s, const int8_t cidr)
char * UTIL_url_encode (const char *s)
char * UTIL_reverse (const char *s, const char delim)
SPF_BOOL UTIL_addnode (split_str_t *master, const char *s, SPF_BOOL last)


Function Documentation

void _printf_dbg u_int8_t  level,
const char *  function,
const char *  format,
  ...
 

Definition at line 61 of file util.c.

References confg, DEBUG_LOG_FILE, f_bit_set, spf_config_s::level, MAX_DEBUG_LEN, and SIZEOF.

void dummy_debug const u_int8_t  level,
const char *  function,
const char *  format,
  ...
 

Definition at line 106 of file util.c.

SPF_BOOL UTIL_a_cmp peer_info_t peer_info,
const char *  s,
const int8_t  cidr
 

Definition at line 791 of file util.c.

References policy_addr_s::addr, peer_info_s::addr, policy_addr_s::cidr, peer_info_s::cur_dom, FALSE, SPF_BOOL, SPF_PASS, TRUE, UTIL_assoc_prefix(), UTIL_cidr_cmp(), UTIL_index(), xeprintf, xfree, xmalloc, xstrndup, and xvprintf.

Referenced by SPF_parse_policy().

SPF_BOOL UTIL_addnode split_str_t master,
const char *  s,
SPF_BOOL  last
 

Definition at line 2020 of file util.c.

References split_str_s::elements, FALSE, split_str_s::head, split_str_node_s::len, split_str_node_s::next, split_str_node_s::s, SPF_BOOL, split_str_s::tail, TRUE, xeprintf, and xmalloc.

Referenced by UTIL_reverse().

SPF_BOOL UTIL_assoc_prefix peer_info_t peer_info,
SPF_RESULT  p,
const char *  s
 

Definition at line 1076 of file util.c.

References peer_info_s::error, FALSE, peer_info_s::last_m, MAX_ERROR, peer_info_s::RES, peer_info_s::rs, spf_result_t::s, SPF_BOOL, SPF_ERROR, SPF_H_FAIL, SPF_NEUTRAL, SPF_NONE, SPF_PASS, peer_info_s::spf_result, spf_rlevel, SPF_S_FAIL, SPF_UNKNOWN, SPF_UNMECH, TRUE, UTIL_index(), and xvprintf.

Referenced by DNS_query(), SPF_init(), SPF_parse_policy(), SPF_policy_main_rec(), UTIL_a_cmp(), UTIL_mx_cmp(), and UTIL_validate_hostname().

SPF_BOOL UTIL_cidr_cmp peer_info_t peer_info,
const policy_addr_t policy_addr,
const struct in_addr *  peer_addr
 

Definition at line 1604 of file util.c.

References policy_addr_s::addr, policy_addr_s::cidr, FALSE, IP_ADDR, SPF_BOOL, TRUE, xeprintf, xfree, xstrndup, and xvprintf.

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

u_int8_t UTIL_count_delim const char *  s,
const char  c
 

Definition at line 541 of file util.c.

References xeprintf, and xvprintf.

Referenced by MACRO_eatmore(), and UTIL_get_dname().

policy_addr_t* UTIL_expand_ip const char *  s  ) 
 

Definition at line 1365 of file util.c.

References policy_addr_s::addr, policy_addr_s::cidr, UTIL_index(), xeprintf, xfree, xmalloc, xstrndup, and xvprintf.

Referenced by SPF_parse_policy().

void UTIL_free void *  p,
const char *  file,
const int32_t  line,
const char *  func
 

Definition at line 358 of file util.c.

References xvprintf.

char* UTIL_get_date void   ) 
 

Definition at line 153 of file util.c.

Referenced by UTIL_log_result().

char* UTIL_get_dname const char *  s  ) 
 

Definition at line 1557 of file util.c.

References UTIL_count_delim(), UTIL_split_str(), xeprintf, xstrndup, and xvprintf.

Referenced by DNS_ptr_answer().

SPF_RESULT UTIL_get_mech_prefix peer_info_t peer_info,
const char *  s
 

Definition at line 1262 of file util.c.

References peer_info_s::ALL, peer_info_s::last_m, peer_info_s::RES_P, SPF_ERROR, SPF_H_FAIL, SPF_NEUTRAL, SPF_PASS, SPF_RESULT, spf_rlevel, SPF_S_FAIL, TRUE, UTIL_index(), xeprintf, and xvprintf.

Referenced by SPF_parse_policy().

SPF_MECHANISM UTIL_get_policy_mech const char *  s  ) 
 

Definition at line 980 of file util.c.

References A, ALL, DEFAULT, EXISTS, EXPLAIN, INCLUDE, IP4, IP6, MX, NO_POLICY, PTR, REDIRECT, SPF_MECHANISM, UNMECH, VERSION, xeprintf, and xvprintf.

Referenced by SPF_parse_policy().

size_t UTIL_guess_whats_in_the_box char *  s,
const char  c,
const u_int16_t  num
 

Definition at line 580 of file util.c.

References xeprintf, and xvprintf.

int16_t UTIL_index const char *  s,
const char  c
 

Definition at line 387 of file util.c.

References xeprintf, and xvprintf.

Referenced by MACRO_expand(), SPF_parse_policy(), UTIL_a_cmp(), UTIL_assoc_prefix(), UTIL_expand_ip(), and UTIL_get_mech_prefix().

SPF_BOOL UTIL_is_ip const char *  id  ) 
 

Definition at line 1459 of file util.c.

References FALSE, SPF_BOOL, and TRUE.

SPF_BOOL UTIL_is_macro const char *  s  ) 
 

Definition at line 687 of file util.c.

References FALSE, SPF_BOOL, TRUE, xeprintf, and xvprintf.

Referenced by SPF_parse_policy().

SPF_BOOL UTIL_is_spf_delim const char  c  ) 
 

Definition at line 635 of file util.c.

References FALSE, SPF_BOOL, TRUE, and xvprintf.

Referenced by MACRO_eatmore().

SPF_BOOL UTIL_is_spf_result const char  c  ) 
 

Definition at line 661 of file util.c.

References FALSE, SPF_BOOL, TRUE, and xvprintf.

Referenced by SPF_parse_policy().

void UTIL_log_result peer_info_t peer_info  ) 
 

Definition at line 180 of file util.c.

References peer_info_s::error, peer_info_s::from, MAX_DEBUG_LEN, OUTPUT_LOG_FILE, peer_info_s::r_ip, peer_info_s::RES, peer_info_s::spf_result, spf_rlevel, peer_info_s::spf_ver, SPF_VERSION, and UTIL_get_date().

Referenced by SPF_policy_main_rec().

void* UTIL_malloc const int32_t  n,
const char *  file,
int32_t  line,
const char *  func
 

Definition at line 290 of file util.c.

References xvprintf.

Referenced by UTIL_realloc().

SPF_BOOL UTIL_mx_cmp peer_info_t peer_info,
const char *  s,
const int8_t  cidr
 

Definition at line 728 of file util.c.

References peer_info_s::addr, DNS_query(), FALSE, peer_info_s::from, SPF_BOOL, SPF_PASS, TRUE, UTIL_assoc_prefix(), UTIL_validate_hostname(), xeprintf, xfree, xstrndup, and xvprintf.

Referenced by SPF_parse_policy().

char* UTIL_printf char *  format,
  ...
 

Definition at line 127 of file util.c.

References xvprintf.

SPF_BOOL UTIL_ptr_cmp peer_info_t peer_info,
const char *  s
 

Definition at line 923 of file util.c.

References peer_info_s::cur_dom, DNS_query(), peer_info_s::error, FALSE, peer_info_s::r_ip, peer_info_s::rs, SPF_BOOL, TRUE, UTIL_rev_addr(), xeprintf, xfree, xstrndup, and xvprintf.

Referenced by SPF_parse_policy().

void* UTIL_realloc void *  p,
const int32_t  n,
const char *  file,
const int32_t  line,
const char *  func
 

Definition at line 321 of file util.c.

References UTIL_malloc(), and xvprintf.

char* UTIL_rev_addr const char *  s  ) 
 

Definition at line 1498 of file util.c.

References xeprintf, xfree, xmalloc, xstrndup, and xvprintf.

Referenced by UTIL_ptr_cmp(), and UTIL_validate_ptr().

char* UTIL_reverse const char *  s,
const char  delim
 

Definition at line 1933 of file util.c.

References split_str_s::elements, FALSE, split_str_s::head, split_str_node_s::len, split_str_node_s::next, split_str_node_s::s, split_str_s::tail, TRUE, UTIL_addnode(), xeprintf, xfree, xmalloc, xstrndup, and xvprintf.

Referenced by MACRO_eatmore().

char* UTIL_split_str const char *  s,
const char  c,
const u_int8_t  num
 

Definition at line 425 of file util.c.

References xeprintf, xfree, xstrndup, and xvprintf.

Referenced by UTIL_get_dname().

char* UTIL_split_strr const char *  s,
const char  c,
const u_int8_t  num
 

Definition at line 475 of file util.c.

References xeprintf, xfree, xstrndup, and xvprintf.

Referenced by MACRO_eatmore().

char* UTIL_strdup const char *  s  ) 
 

Definition at line 257 of file util.c.

References FALSE, xeprintf, and xvprintf.

char* UTIL_strndup const char *  s,
const size_t  n
 

Definition at line 221 of file util.c.

References FALSE, xeprintf, xmalloc, and xvprintf.

char* UTIL_url_encode const char *  s  ) 
 

Definition at line 1881 of file util.c.

References urlchr_test, xeprintf, xmalloc, and xvprintf.

SPF_BOOL UTIL_validate_hostname peer_info_t peer_info,
const char *  s,
const int8_t  cidr
 

Definition at line 1719 of file util.c.

References peer_info_s::addr, policy_addr_s::addr, policy_addr_s::cidr, FALSE, IP_ADDR, peer_info_s::r_ip, SPF_BOOL, SPF_PASS, TRUE, UTIL_assoc_prefix(), UTIL_cidr_cmp(), xeprintf, xfree, xmalloc, xstrndup, and xvprintf.

Referenced by DNS_ptr_answer(), and UTIL_mx_cmp().

SPF_BOOL UTIL_validate_ptr peer_info_t peer_info  ) 
 

Definition at line 1673 of file util.c.

References peer_info_s::cur_dom, DNS_query(), peer_info_s::error, FALSE, peer_info_s::r_ip, peer_info_s::r_vhname, peer_info_s::rs, SPF_BOOL, TRUE, UTIL_rev_addr(), xfree, xstrndup, and xvprintf.

Referenced by MACRO_process().


Generated on Thu Jul 1 14:05:44 2004 for libspf v1.0 by doxygen 1.3.7