ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libspf/docs/API/doxygen/html/dns_8h-source.html
Revision: 1.1
Committed: Tue Nov 13 00:51:25 2007 UTC (18 years, 10 months ago) by root
Content type: text/html
Branch: MAIN
CVS Tags: HEAD
Log Message:
initial import of libspf-1.0.0-p5 from freebsd ports

File Contents

# User Rev Content
1 root 1.1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2     <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3     <title>libSPF v1.0: dns.h Source File</title>
4     <link href="doxygen.css" rel="stylesheet" type="text/css">
5     </head><body>
6     <!-- Generated by Doxygen 1.3.8 -->
7     <div class="qindex"> <form class="search" action="search.php" method="get">
8     <a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
9     <h1>dns.h</h1><a href="dns_8h.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">/* libspf - Sender Policy Framework library</span>
10     00002 <span class="comment">*</span>
11     00003 <span class="comment">* ANSI C implementation of spf-draft-200405.txt</span>
12     00004 <span class="comment">*</span>
13     00005 <span class="comment">* Author: James Couzens &lt;jcouzens@codeshare.ca&gt;</span>
14     00006 <span class="comment">* Author: Sean Comeau &lt;scomeau@obscurity.org&gt;</span>
15     00007 <span class="comment">*</span>
16     00008 <span class="comment">* FILE: dns.h</span>
17     00009 <span class="comment">* DESC: dns functions header file</span>
18     00010 <span class="comment">*</span>
19     00011 <span class="comment">* License:</span>
20     00012 <span class="comment">*</span>
21     00013 <span class="comment">* The libspf Software License, Version 1.0</span>
22     00014 <span class="comment">*</span>
23     00015 <span class="comment">* Copyright (c) 2004 James Couzens &amp; Sean Comeau All rights</span>
24     00016 <span class="comment">* reserved.</span>
25     00017 <span class="comment">*</span>
26     00018 <span class="comment">* Redistribution and use in source and binary forms, with or without</span>
27     00019 <span class="comment">* modification, are permitted provided that the following conditions</span>
28     00020 <span class="comment">* are met:</span>
29     00021 <span class="comment">*</span>
30     00022 <span class="comment">* 1. Redistributions of source code must retain the above copyright</span>
31     00023 <span class="comment">* notice, this list of conditions and the following disclaimer.</span>
32     00024 <span class="comment">*</span>
33     00025 <span class="comment">* 2. Redistributions in binary form must reproduce the above copyright</span>
34     00026 <span class="comment">* notice, this list of conditions and the following disclaimer in</span>
35     00027 <span class="comment">* the documentation and/or other materials provided with the</span>
36     00028 <span class="comment">* distribution.</span>
37     00029 <span class="comment">*</span>
38     00030 <span class="comment">* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED</span>
39     00031 <span class="comment">* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES</span>
40     00032 <span class="comment">* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span>
41     00033 <span class="comment">* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS MAKING USE OF THIS LICESEN</span>
42     00034 <span class="comment">* OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,</span>
43     00035 <span class="comment">* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT</span>
44     00036 <span class="comment">* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF</span>
45     00037 <span class="comment">* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
46     00038 <span class="comment">* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</span>
47     00039 <span class="comment">* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT</span>
48     00040 <span class="comment">* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>
49     00041 <span class="comment">* SUCH DAMAGE.</span>
50     00042 <span class="comment">*</span>
51     00043 <span class="comment">*/</span>
52     00044
53     00045 <span class="preprocessor">#ifndef _DNS_H</span>
54     <a name="l00046"></a><a class="code" href="dns_8h.html#a0">00046</a> <span class="preprocessor"></span><span class="preprocessor">#define _DNS_H 1</span>
55     00047 <span class="preprocessor"></span>
56     00048 <span class="preprocessor">#include "../../config.h"</span> <span class="comment">/* autoconf */</span>
57     00049 <span class="preprocessor">#include &lt;stdio.h&gt;</span> <span class="comment">/* printf */</span>
58     00050 <span class="preprocessor">#include &lt;string.h&gt;</span> <span class="comment">/* snprintf strstr */</span>
59     00051 <span class="preprocessor">#include &lt;strings.h&gt;</span> <span class="comment">/* strcasecmp */</span>
60     00052 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span> <span class="comment">/* inet_ functions / structs */</span>
61     00053 <span class="preprocessor">#include &lt;netinet/in.h&gt;</span> <span class="comment">/* inet_ functions / structs */</span>
62     00054 <span class="preprocessor">#include &lt;arpa/nameser.h&gt;</span> <span class="comment">/* DNS HEADER struct */</span>
63     00055 <span class="preprocessor">#include &lt;resolv.h&gt;</span> <span class="comment">/* dn_skipname */</span>
64     00056 <span class="preprocessor">#include &lt;netdb.h&gt;</span> <span class="comment">/* gethostbyname */</span>
65     00057 <span class="preprocessor">#include &lt;arpa/inet.h&gt;</span> <span class="comment">/* in_addr struct */</span>
66     00058
67     00059 <span class="preprocessor">#ifdef _WITH_DARWINPPC</span>
68     00060 <span class="preprocessor"></span><span class="preprocessor">#include &lt;nameser8_compat.h&gt;</span> <span class="comment">/* T_CNAME */</span>
69     00061 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_DARWINPCC */</span>
70     00062
71     00063 <span class="preprocessor">#ifdef _WITH_PTHREADS</span>
72     00064 <span class="preprocessor"></span><span class="preprocessor">#include &lt;pthread.h&gt;</span> <span class="comment">/* pthread_mutex_t */</span>
73     00065 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_PTHREADS */</span>
74     00066
75     00067 <span class="preprocessor">#ifdef HAVE__BEGIN_DECLS</span>
76     00068 <span class="preprocessor"></span>__BEGIN_DECLS
77     00069 <span class="preprocessor">#else</span>
78     00070 <span class="preprocessor"></span><span class="preprocessor"># ifdef __cplusplus</span>
79     00071 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">"C"</span> {
80     00072 <span class="preprocessor"># endif </span><span class="comment">/* __cplusplus */</span>
81     00073 <span class="preprocessor">#endif </span><span class="comment">/* HAVE__BEGIN_DECLS */</span>
82     00074
83     00075 <span class="comment">/*</span>
84     00076 <span class="comment">* For reference purposes commented out are the constants based on</span>
85     00077 <span class="comment">* RFC 883, RFC 1034, RFC 1035. Because we're working with IN_TXT</span>
86     00078 <span class="comment">* records we will use a larger packet size at 65536 bytes which</span>
87     00079 <span class="comment">* is likey to cover most circumstances.</span>
88     00080 <span class="comment">*</span>
89     00081 <span class="comment">* #define PACKETSZ 512 max response packet size</span>
90     00082 <span class="comment">* #define MAXDNAME 1025 max uncompressed IN_TXT record</span>
91     00083 <span class="comment">* #define MAXCDNAME 255 max compressed IN_TXT record</span>
92     00084 <span class="comment">*</span>
93     00085 <span class="comment">*/</span>
94     00086
95     <a name="l00087"></a><a class="code" href="dns_8h.html#a1">00087</a> <span class="preprocessor">#define SPF_PACKETSZ 8192</span>
96     <a name="l00088"></a><a class="code" href="dns_8h.html#a2">00088</a> <span class="preprocessor"></span><span class="preprocessor">#define SPF_MAXDNAME 1025</span>
97     <a name="l00089"></a><a class="code" href="dns_8h.html#a3">00089</a> <span class="preprocessor"></span><span class="preprocessor">#define SPF_MAXCDNAME 255</span>
98     00090 <span class="preprocessor"></span>
99     00091 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="dns_8h.html#a6">h_errno</a>;
100     00092
101     00093 <span class="preprocessor">#ifndef HPUX</span>
102     00094 <span class="preprocessor"></span><span class="keyword">struct </span>hostent;
103     00095 <span class="preprocessor">#endif </span><span class="comment">/* HPUX */</span>
104     00096
105     00097 <span class="keywordtype">void</span> <a class="code" href="dns_8h.html#a7">_DNS_gethostbyname_r_free</a>(<span class="keywordtype">void</span>);
106     00098
107     00099 <span class="preprocessor">#ifdef _WITH_PTHREADS</span>
108     00100 <span class="preprocessor"></span> <span class="comment">/* if we've got native gethostbyname_r (GNU extension) */</span>
109     00101 <span class="preprocessor"> #ifdef HAVE_GETHOSTBYNAME_R</span>
110     00102 <span class="preprocessor"></span>
111     00103 <span class="keyword">struct </span>hostent *_DNS_GNU_gethostbyname_r(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">struct</span> hostent *result,
112     00104 <span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> buflen, <span class="keywordtype">int</span> *h_errnop);
113     00105
114     00106 <span class="preprocessor"> #define xgethostbyname(a, b, c, d, e) _DNS_GNU_gethostbyname_r((a), (b), (c), (d), (e))</span>
115     00107 <span class="preprocessor"></span><span class="preprocessor"> #define xgethostbyname_free()</span>
116     00108 <span class="preprocessor"></span>
117     00109 <span class="preprocessor"> #else</span>
118     00110 <span class="preprocessor"></span> <span class="keyword">extern</span> pthread_mutex_t <a class="code" href="dns_8c.html#a0">dns_mutex</a>;
119     00111
120     00112 <span class="keyword">struct </span>hostent *_DNS_gethostbyname_r(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">struct</span> hostent *result,
121     00113 <span class="keywordtype">char</span> *buf, <span class="keywordtype">int</span> buflen, <span class="keywordtype">int</span> *h_errnop);
122     00114
123     00115 <span class="preprocessor"> #define xgethostbyname(a, b, c, d, e) _DNS_gethostbyname_r((a), (b), (c), (d), (e))</span>
124     00116 <span class="preprocessor"></span><span class="preprocessor"> #define xgethostbyname_free() _DNS_gethostbyname_r_free()</span>
125     00117 <span class="preprocessor"></span>
126     00118 <span class="preprocessor"> #endif </span><span class="comment">/* HAVE_GETHOSTBYNAME_R */</span>
127     00119 <span class="preprocessor">#else </span><span class="comment">/* _WITH_PTHREADS */</span>
128     00120
129     <a name="l00121"></a><a class="code" href="dns_8h.html#a4">00121</a> <span class="preprocessor"> #define xgethostbyname(a, b, c, d, e) gethostbyname((a))</span>
130     <a name="l00122"></a><a class="code" href="dns_8h.html#a5">00122</a> <span class="preprocessor"></span><span class="preprocessor"> #define xgethostbyname_free()</span>
131     00123 <span class="preprocessor"></span>
132     00124 <span class="preprocessor">#endif </span><span class="comment">/* _WITH_PTHREADS */</span>
133     00125
134     00126
135     00127 <span class="comment">/* silence link error on SCO */</span>
136     00128 <span class="preprocessor">#ifdef SCO</span>
137     00129 <span class="preprocessor"></span><span class="preprocessor">#undef h_errno</span>
138     00130 <span class="preprocessor"></span><span class="preprocessor">#define h_errno errno</span>
139     00131 <span class="preprocessor"></span><span class="preprocessor">#endif </span><span class="comment">/* SCO */</span>
140     00132
141     00133 <span class="keywordtype">char</span> *<a class="code" href="dns_8h.html#a8">DNS_query</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">int</span> T_TYPE, <span class="keyword">const</span> <span class="keywordtype">char</span> *);
142     00134 <span class="keywordtype">char</span> *<a class="code" href="dns_8h.html#a9">DNS_txt_answer</a>(int16_t, <span class="keyword">const</span> u_char *, <span class="keyword">const</span> u_char *, u_char *,
143     00135 <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> *);
144     00136 <span class="keywordtype">char</span> *<a class="code" href="dns_8h.html#a10">DNS_mx_answer</a>(int16_t, <span class="keyword">const</span> u_char *, <span class="keyword">const</span> u_char *, u_char *,
145     00137 <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> *);
146     00138 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="dns_8h.html#a11">DNS_ptr_answer</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *, int16_t, <span class="keyword">const</span> u_char *, <span class="keyword">const</span> u_char *,
147     00139 u_char *, <span class="keywordtype">char</span> *, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> *);
148     00140 <span class="keywordtype">char</span> *<a class="code" href="dns_8h.html#a12">DNS_cname_answer</a>(int16_t, <span class="keyword">const</span> u_char *, <span class="keyword">const</span> u_char *,
149     00141 u_char *, <span class="keywordtype">char</span> *, <span class="keywordtype">int</span> *);
150     00142 <a class="code" href="spf_8h.html#a35">SPF_BOOL</a> <a class="code" href="dns_8h.html#a13">DNS_check_client_reverse</a>(<a class="code" href="structpeer__info__s.html">peer_info_t</a> *);
151     00143
152     00144
153     00145 <span class="preprocessor">#ifdef HAVE__BEGIN_DECLS</span>
154     00146 <span class="preprocessor"></span>__END_DECLS <span class="comment">/* _DNS_H */</span>
155     00147 <span class="preprocessor">#else</span>
156     00148 <span class="preprocessor"></span><span class="preprocessor"># ifdef __cplusplus</span>
157     00149 <span class="preprocessor"></span>}
158     00150 <span class="preprocessor"># endif </span><span class="comment">/* __cplusplus */</span>
159     00151 <span class="preprocessor">#endif </span><span class="comment">/* HAVE__BEGIN_DECLS */</span>
160     00152
161     00153 <span class="preprocessor">#endif </span><span class="comment">/* _DNS_H */</span>
162     00154
163     00155 <span class="comment">/* end dns.h */</span>
164     </div></pre><hr size="1"><address style="align: right;"><small>Generated on Thu Sep 16 18:10:46 2004 for libSPF v1.0 by
165     <a href="http://www.doxygen.org/index.html">
166     <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
167     </body>
168     </html>