spf_dns.h

Go to the documentation of this file.
00001 /* 
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of either:
00004  * 
00005  *   a) The GNU Lesser General Public License as published by the Free
00006  *      Software Foundation; either version 2.1, or (at your option) any
00007  *      later version,
00008  * 
00009  *   OR
00010  * 
00011  *   b) The two-clause BSD license.
00012  *
00013  * These licenses can be found with the distribution in the file LICENSES
00014  */
00015 
00016 
00017 
00018 
00019 #ifndef INC_SPF_DNS
00020 #define INC_SPF_DNS
00021 
00022 
00067 /*
00068  * For those who don't have <arpa/nameserv.h>
00069  */
00070 
00071 /* XXX This should use a more sensible define. */
00072 #if !defined( HAVE_NS_TYPE )
00073 
00074 #define ns_t_invalid    0
00075 #define ns_t_a          1
00076 #define ns_t_ns         2
00077 #define ns_t_cname      5
00078 #define ns_t_ptr        12
00079 #define ns_t_mx         15
00080 #define ns_t_txt        16
00081 #define ns_t_aaaa       28
00082 /* #define ns_t_a6              38 */
00083 #define ns_t_any        255             
00085 typedef int     ns_type;
00086 #endif
00087 
00088 #if ! HAVE_DECL_NS_T_SPF
00089 #define ns_t_spf        99
00090 #endif
00091 
00092 #if ! HAVE_DECL_NS_T_INVALID
00093 #define ns_t_invalid    0
00094 #endif
00095 
00096 
00097 /*
00098  * For those who don't have <netdb.h>
00099  */
00100 
00101 #if !defined(HAVE_NETDB_H) && !defined(_WIN32)
00102 #define NETDB_SUCCESS   0
00103 #define HOST_NOT_FOUND  1               
00104 #define TRY_AGAIN               2               
00105 #define NO_RECOVERY             3               
00106 #define NO_DATA                 4               
00107 #endif
00108 typedef int SPF_dns_stat_t;
00109 
00110 typedef struct SPF_dns_server_struct SPF_dns_server_t;
00111 
00112 #include "spf_request.h"
00113 #include "spf_dns_rr.h"
00114 
00115 /*
00116  * bundle up the info needed to use a dns method
00117  */
00118 
00119 typedef void (*SPF_dns_destroy_t)(SPF_dns_server_t *spf_dns_server);
00120 typedef SPF_dns_rr_t *(*SPF_dns_lookup_t)(
00121                                 SPF_dns_server_t *spf_dns_server,
00122                                 const char *domain,
00123                                 ns_type ns_type, int should_cache
00124                                         );
00125 typedef SPF_errcode_t (*SPF_dns_get_spf_t)( SPF_server_t *spf_server,
00126                                         SPF_request_t *spf_request,
00127                                         SPF_response_t *spf_response,
00128                                         SPF_record_t **spf_recordp);
00129 typedef SPF_errcode_t (*SPF_dns_get_exp_t)( SPF_server_t *spf_server,
00130                                         const char *domain,
00131                                         char **buf, size_t *buf_len );
00132 typedef int (*SPF_dns_add_cache_t)( SPF_server_t *spf_server,
00133                                     SPF_dns_rr_t spfrr );
00134 
00135 struct SPF_dns_server_struct
00136 {
00142     SPF_dns_destroy_t    destroy;
00143 
00144     SPF_dns_lookup_t     lookup;
00145     SPF_dns_get_spf_t    get_spf;
00146     SPF_dns_get_exp_t    get_exp;
00147     SPF_dns_add_cache_t  add_cache;
00148 
00149     /* the next DNS layer down to call if this layer can't give an answer */
00150     SPF_dns_server_t    *layer_below;
00151 
00152     const char                  *name;          /* name of the layer            */
00153         int                                      debug;
00154     void                                *hook;          /* server-specific data */
00155 };
00156 
00157 
00158 void                     SPF_dns_free( SPF_dns_server_t *spf_dns_server );
00159 SPF_dns_rr_t    *SPF_dns_lookup( SPF_dns_server_t *spf_dns_server,
00160                               const char *domain, ns_type rr_type,
00161                               int should_cache );
00162 SPF_dns_rr_t    *SPF_dns_rlookup( SPF_dns_server_t *spf_dns_server,
00163                                struct in_addr ipv4, ns_type rr_type,
00164                                int should_cache );
00165 SPF_dns_rr_t    *SPF_dns_rlookup6( SPF_dns_server_t *spf_dns_server,
00166                                 struct in6_addr ipv6, ns_type rr_type,
00167                                 int should_cache );
00168 
00169 
00177 char            *SPF_dns_get_client_dom(SPF_dns_server_t *spf_dns_server,
00178                                 SPF_request_t *sr);
00179 
00180 
00181 #endif

Generated on Tue Nov 4 13:27:38 2008 for libspf2 by  doxygen 1.5.4