ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libspf/docs/API/doxygen/html/dns_8h.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 File Reference</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 File Reference</h1><code>#include "../../config.h"</code><br>
10     <code>#include &lt;stdio.h&gt;</code><br>
11     <code>#include &lt;string.h&gt;</code><br>
12     <code>#include &lt;strings.h&gt;</code><br>
13     <code>#include &lt;sys/socket.h&gt;</code><br>
14     <code>#include &lt;netinet/in.h&gt;</code><br>
15     <code>#include &lt;arpa/nameser.h&gt;</code><br>
16     <code>#include &lt;resolv.h&gt;</code><br>
17     <code>#include &lt;netdb.h&gt;</code><br>
18     <code>#include &lt;arpa/inet.h&gt;</code><br>
19    
20     <p>
21     Include dependency graph for dns.h:<p><center><img src="dns_8h__incl.png" border="0" usemap="#dns.h_map" alt="Include dependency graph"></center>
22    
23     <p>
24     This graph shows which files directly or indirectly include this file:<p><center><img src="dns_8h__dep__incl.png" border="0" usemap="#dns.hdep_map" alt="Included by dependency graph"></center>
25     <map name="dns.hdep_map">
26     <area href="dns_8c.html" shape="rect" coords="7,17,49,36" alt="">
27     <area href="macro_8c.html" shape="rect" coords="73,17,132,36" alt="">
28     <area href="main_8c.html" shape="rect" coords="156,17,207,36" alt="">
29     <area href="util_8c.html" shape="rect" coords="231,17,268,36" alt="">
30     </map>
31    
32     <p>
33     <a href="dns_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
34     <tr><td></td></tr>
35     <tr><td colspan=2><br><h2>Defines</h2></td></tr>
36     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a0">_DNS_H</a>&nbsp;&nbsp;&nbsp;1</td></tr>
37    
38     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a1">SPF_PACKETSZ</a>&nbsp;&nbsp;&nbsp;8192</td></tr>
39    
40     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a2">SPF_MAXDNAME</a>&nbsp;&nbsp;&nbsp;1025</td></tr>
41    
42     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a3">SPF_MAXCDNAME</a>&nbsp;&nbsp;&nbsp;255</td></tr>
43    
44     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a4">xgethostbyname</a>(a, b, c, d, e)&nbsp;&nbsp;&nbsp;gethostbyname((a))</td></tr>
45    
46     <tr><td class="memItemLeft" nowrap align=right valign=top>#define&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a5">xgethostbyname_free</a>()</td></tr>
47    
48     <tr><td colspan=2><br><h2>Functions</h2></td></tr>
49     <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a7">_DNS_gethostbyname_r_free</a> (void)</td></tr>
50    
51     <tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a8">DNS_query</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *, const char *, const int T_TYPE, const char *)</td></tr>
52    
53     <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Execute a DNS query. <a href="#a8"></a><br></td></tr>
54     <tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a9">DNS_txt_answer</a> (int16_t, const u_char *, const u_char *, u_char *, char *, int *)</td></tr>
55    
56     <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a DNS message of type T_TXT. <a href="#a9"></a><br></td></tr>
57     <tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a10">DNS_mx_answer</a> (int16_t, const u_char *, const u_char *, u_char *, char *, int *)</td></tr>
58    
59     <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a DNS message of type T_MX. <a href="#a10"></a><br></td></tr>
60     <tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="spf_8h.html#a35">SPF_BOOL</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a11">DNS_ptr_answer</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *, int16_t, const u_char *, const u_char *, u_char *, char *, const char *, int *)</td></tr>
61    
62     <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a DNS message of type T_PTR. <a href="#a11"></a><br></td></tr>
63     <tr><td class="memItemLeft" nowrap align=right valign=top>char *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a12">DNS_cname_answer</a> (int16_t, const u_char *, const u_char *, u_char *, char *, int *)</td></tr>
64    
65     <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Process a DNS message of type T_MX. <a href="#a12"></a><br></td></tr>
66     <tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="spf_8h.html#a35">SPF_BOOL</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a13">DNS_check_client_reverse</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *)</td></tr>
67    
68     <tr><td colspan=2><br><h2>Variables</h2></td></tr>
69     <tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="dns_8h.html#a6">h_errno</a></td></tr>
70    
71     </table>
72     <hr><h2>Define Documentation</h2>
73     <a class="anchor" name="a0" doxytag="dns.h::_DNS_H" ></a><p>
74     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
75     <tr>
76     <td class="mdRow">
77     <table cellpadding="0" cellspacing="0" border="0">
78     <tr>
79     <td class="md" nowrap valign="top"> #define _DNS_H&nbsp;&nbsp;&nbsp;1 </td>
80     </tr>
81     </table>
82     </td>
83     </tr>
84     </table>
85     <table cellspacing=5 cellpadding=0 border=0>
86     <tr>
87     <td>
88     &nbsp;
89     </td>
90     <td>
91    
92     <p>
93     Definition at line <a class="el" href="dns_8h-source.html#l00046">46</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>. </td>
94     </tr>
95     </table>
96     <a class="anchor" name="a3" doxytag="dns.h::SPF_MAXCDNAME" ></a><p>
97     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
98     <tr>
99     <td class="mdRow">
100     <table cellpadding="0" cellspacing="0" border="0">
101     <tr>
102     <td class="md" nowrap valign="top"> #define SPF_MAXCDNAME&nbsp;&nbsp;&nbsp;255 </td>
103     </tr>
104     </table>
105     </td>
106     </tr>
107     </table>
108     <table cellspacing=5 cellpadding=0 border=0>
109     <tr>
110     <td>
111     &nbsp;
112     </td>
113     <td>
114    
115     <p>
116     Definition at line <a class="el" href="dns_8h-source.html#l00089">89</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.
117     <p>
118     Referenced by <a class="el" href="dns_8c-source.html#l00975">DNS_check_client_reverse()</a>, <a class="el" href="dns_8c-source.html#l00866">DNS_cname_answer()</a>, <a class="el" href="dns_8c-source.html#l00611">DNS_mx_answer()</a>, <a class="el" href="dns_8c-source.html#l00716">DNS_ptr_answer()</a>, and <a class="el" href="dns_8c-source.html#l00419">DNS_txt_answer()</a>. </td>
119     </tr>
120     </table>
121     <a class="anchor" name="a2" doxytag="dns.h::SPF_MAXDNAME" ></a><p>
122     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
123     <tr>
124     <td class="mdRow">
125     <table cellpadding="0" cellspacing="0" border="0">
126     <tr>
127     <td class="md" nowrap valign="top"> #define SPF_MAXDNAME&nbsp;&nbsp;&nbsp;1025 </td>
128     </tr>
129     </table>
130     </td>
131     </tr>
132     </table>
133     <table cellspacing=5 cellpadding=0 border=0>
134     <tr>
135     <td>
136     &nbsp;
137     </td>
138     <td>
139    
140     <p>
141     Definition at line <a class="el" href="dns_8h-source.html#l00088">88</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.
142     <p>
143     Referenced by <a class="el" href="dns_8c-source.html#l00975">DNS_check_client_reverse()</a>, and <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td>
144     </tr>
145     </table>
146     <a class="anchor" name="a1" doxytag="dns.h::SPF_PACKETSZ" ></a><p>
147     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
148     <tr>
149     <td class="mdRow">
150     <table cellpadding="0" cellspacing="0" border="0">
151     <tr>
152     <td class="md" nowrap valign="top"> #define SPF_PACKETSZ&nbsp;&nbsp;&nbsp;8192 </td>
153     </tr>
154     </table>
155     </td>
156     </tr>
157     </table>
158     <table cellspacing=5 cellpadding=0 border=0>
159     <tr>
160     <td>
161     &nbsp;
162     </td>
163     <td>
164    
165     <p>
166     Definition at line <a class="el" href="dns_8h-source.html#l00087">87</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.
167     <p>
168     Referenced by <a class="el" href="dns_8c-source.html#l00975">DNS_check_client_reverse()</a>, and <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td>
169     </tr>
170     </table>
171     <a class="anchor" name="a4" doxytag="dns.h::xgethostbyname" ></a><p>
172     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
173     <tr>
174     <td class="mdRow">
175     <table cellpadding="0" cellspacing="0" border="0">
176     <tr>
177     <td class="md" nowrap valign="top"> #define xgethostbyname </td>
178     <td class="md" valign="top">(&nbsp;</td>
179     <td class="md" nowrap valign="top">a, <tr>
180     <td class="md" nowrap align="right"></td>
181     <td></td>
182     <td class="md" nowrap>b, <tr>
183     <td class="md" nowrap align="right"></td>
184     <td></td>
185     <td class="md" nowrap>c, <tr>
186     <td class="md" nowrap align="right"></td>
187     <td></td>
188     <td class="md" nowrap>d, <tr>
189     <td class="md" nowrap align="right"></td>
190     <td></td>
191     <td class="md" nowrap>e&nbsp;</td>
192     <td class="mdname1" valign="top" nowrap> </td>
193     <td class="md" valign="top">&nbsp;)&nbsp;</td>
194     <td class="md" nowrap>&nbsp;&nbsp;&nbsp;gethostbyname((a))</td>
195     </tr>
196     </table>
197     </td>
198     </tr>
199     </table>
200     <table cellspacing=5 cellpadding=0 border=0>
201     <tr>
202     <td>
203     &nbsp;
204     </td>
205     <td>
206    
207     <p>
208     Definition at line <a class="el" href="dns_8h-source.html#l00121">121</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.
209     <p>
210     Referenced by <a class="el" href="util_8c-source.html#l00980">UTIL_a_cmp()</a>, and <a class="el" href="util_8c-source.html#l02100">UTIL_validate_hostname()</a>. </td>
211     </tr>
212     </table>
213     <a class="anchor" name="a5" doxytag="dns.h::xgethostbyname_free" ></a><p>
214     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
215     <tr>
216     <td class="mdRow">
217     <table cellpadding="0" cellspacing="0" border="0">
218     <tr>
219     <td class="md" nowrap valign="top"> #define xgethostbyname_free </td>
220     <td class="md" valign="top">(&nbsp;</td>
221     &nbsp;</td>
222     <td class="mdname1" valign="top" nowrap> </td>
223     <td class="md" valign="top">&nbsp;)&nbsp;</td>
224     <td class="md" nowrap></td>
225     </tr>
226     </table>
227     </td>
228     </tr>
229     </table>
230     <table cellspacing=5 cellpadding=0 border=0>
231     <tr>
232     <td>
233     &nbsp;
234     </td>
235     <td>
236    
237     <p>
238     Definition at line <a class="el" href="dns_8h-source.html#l00122">122</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.
239     <p>
240     Referenced by <a class="el" href="util_8c-source.html#l00980">UTIL_a_cmp()</a>, and <a class="el" href="util_8c-source.html#l02100">UTIL_validate_hostname()</a>. </td>
241     </tr>
242     </table>
243     <hr><h2>Function Documentation</h2>
244     <a class="anchor" name="a7" doxytag="dns.h::_DNS_gethostbyname_r_free" ></a><p>
245     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
246     <tr>
247     <td class="mdRow">
248     <table cellpadding="0" cellspacing="0" border="0">
249     <tr>
250     <td class="md" nowrap valign="top"> void _DNS_gethostbyname_r_free </td>
251     <td class="md" valign="top">(&nbsp;</td>
252     <td class="md" nowrap valign="top">void&nbsp;</td>
253     <td class="mdname1" valign="top" nowrap> </td>
254     <td class="md" valign="top">&nbsp;)&nbsp;</td>
255     <td class="md" nowrap></td>
256     </tr>
257     </table>
258     </td>
259     </tr>
260     </table>
261     <table cellspacing=5 cellpadding=0 border=0>
262     <tr>
263     <td>
264     &nbsp;
265     </td>
266     <td>
267    
268     <p>
269     </td>
270     </tr>
271     </table>
272     <a class="anchor" name="a13" doxytag="dns.h::DNS_check_client_reverse" ></a><p>
273     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
274     <tr>
275     <td class="mdRow">
276     <table cellpadding="0" cellspacing="0" border="0">
277     <tr>
278     <td class="md" nowrap valign="top"> <a class="el" href="spf_8h.html#a35">SPF_BOOL</a> DNS_check_client_reverse </td>
279     <td class="md" valign="top">(&nbsp;</td>
280     <td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> *&nbsp;</td>
281     <td class="mdname1" valign="top" nowrap> </td>
282     <td class="md" valign="top">&nbsp;)&nbsp;</td>
283     <td class="md" nowrap></td>
284     </tr>
285     </table>
286     </td>
287     </tr>
288     </table>
289     <table cellspacing=5 cellpadding=0 border=0>
290     <tr>
291     <td>
292     &nbsp;
293     </td>
294     <td>
295    
296     <p>
297     Definition at line <a class="el" href="dns_8c-source.html#l00975">975</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
298     <p>
299     References <a class="el" href="spf_8h.html#a46">peer_info_t</a>, <a class="el" href="spf_8h-source.html#l00351">peer_info_s::r_ip</a>, <a class="el" href="spf_8h-source.html#l00352">peer_info_s::r_vhname</a>, <a class="el" href="spf_8h.html#a35">SPF_BOOL</a>, <a class="el" href="spf_8h.html#a87a49">SPF_FALSE</a>, <a class="el" href="dns_8h-source.html#l00089">SPF_MAXCDNAME</a>, <a class="el" href="dns_8h-source.html#l00088">SPF_MAXDNAME</a>, <a class="el" href="dns_8h-source.html#l00087">SPF_PACKETSZ</a>, <a class="el" href="spf_8h.html#a87a50">SPF_TRUE</a>, <a class="el" href="util_8c-source.html#l01843">UTIL_rev_addr()</a>, <a class="el" href="util_8c-source.html#l02100">UTIL_validate_hostname()</a>, <a class="el" href="util_8h-source.html#l00154">xepprintf</a>, <a class="el" href="util_8h-source.html#l00150">xeprintf</a>, <a class="el" href="util_8h-source.html#l00127">xfree</a>, <a class="el" href="util_8h-source.html#l00146">xpprintf</a>, <a class="el" href="util_8h-source.html#l00129">xstrndup</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
300     <p>
301     Referenced by <a class="el" href="macro_8c-source.html#l00301">MACRO_process()</a>.
302     <p>
303     Here is the call graph for this function:<p><center><img src="dns_8h_a13_cgraph.png" border="0" usemap="#dns_8h_a13_cgraph_map" alt=""></center>
304     <map name="dns_8h_a13_cgraph_map">
305     <area href="util_8h.html#a50" shape="rect" coords="271,5,372,23" alt="">
306     <area href="util_8h.html#a54" shape="rect" coords="243,47,400,66" alt="">
307     <area href="util_8h.html#a47" shape="rect" coords="451,26,571,45" alt="">
308     <area href="util_8h.html#a52" shape="rect" coords="460,69,561,87" alt="">
309     <area href="util_8h.html#a35" shape="rect" coords="620,26,700,45" alt="">
310     </map>
311     </td>
312     </tr>
313     </table>
314     <a class="anchor" name="a12" doxytag="dns.h::DNS_cname_answer" ></a><p>
315     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
316     <tr>
317     <td class="mdRow">
318     <table cellpadding="0" cellspacing="0" border="0">
319     <tr>
320     <td class="md" nowrap valign="top"> char* DNS_cname_answer </td>
321     <td class="md" valign="top">(&nbsp;</td>
322     <td class="md" nowrap valign="top">int16_t&nbsp;</td>
323     <td class="mdname" nowrap> <em>ancount</em>, </td>
324     </tr>
325     <tr>
326     <td class="md" nowrap align="right"></td>
327     <td></td>
328     <td class="md" nowrap>const u_char *&nbsp;</td>
329     <td class="mdname" nowrap> <em>msg_ptr</em>, </td>
330     </tr>
331     <tr>
332     <td class="md" nowrap align="right"></td>
333     <td></td>
334     <td class="md" nowrap>const u_char *&nbsp;</td>
335     <td class="mdname" nowrap> <em>eom_ptr</em>, </td>
336     </tr>
337     <tr>
338     <td class="md" nowrap align="right"></td>
339     <td></td>
340     <td class="md" nowrap>u_char *&nbsp;</td>
341     <td class="mdname" nowrap> <em>rd_ptr</em>, </td>
342     </tr>
343     <tr>
344     <td class="md" nowrap align="right"></td>
345     <td></td>
346     <td class="md" nowrap>char *&nbsp;</td>
347     <td class="mdname" nowrap> <em>buf</em>, </td>
348     </tr>
349     <tr>
350     <td class="md" nowrap align="right"></td>
351     <td></td>
352     <td class="md" nowrap>int *&nbsp;</td>
353     <td class="mdname" nowrap> <em>ttl</em></td>
354     </tr>
355     <tr>
356     <td></td>
357     <td class="md">)&nbsp;</td>
358     <td class="md" colspan="2"></td>
359     </tr>
360     </table>
361     </td>
362     </tr>
363     </table>
364     <table cellspacing=5 cellpadding=0 border=0>
365     <tr>
366     <td>
367     &nbsp;
368     </td>
369     <td>
370    
371     <p>
372     Process a DNS message of type T_MX.
373     <p>
374     <dl compact><dt><b>Parameters:</b></dt><dd>
375     <table border="0" cellspacing="2" cellpadding="0">
376     <tr><td></td><td valign=top><em>ancount</em>&nbsp;</td><td>Answer count </td></tr>
377     <tr><td></td><td valign=top><em>msg_ptr</em>&nbsp;</td><td>DNS message </td></tr>
378     <tr><td></td><td valign=top><em>eom_ptr</em>&nbsp;</td><td>Pointer to the end of the DNS message </td></tr>
379     <tr><td></td><td valign=top><em>rd_ptr</em>&nbsp;</td><td>Pointer to a position in the DNS message </td></tr>
380     <tr><td></td><td valign=top><em>buf</em>&nbsp;</td><td>Utiltiy buffer </td></tr>
381     <tr><td></td><td valign=top><em>ttl</em>&nbsp;</td><td>Time To Live value of the DNS message </td></tr>
382     </table>
383     </dl>
384     Author: Teddy &lt;<a href="mailto:teddy@teddy.ch">teddy@teddy.ch</a>&gt;<br>
385     <p>
386     Date: 29/04/04<br>
387     Date: 02/20/04 - Added cache by Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
388     <p>
389     Desc:<br>
390     SPF_PACKETSZ bytes are allocated and then filled with chars. This buffer is then used in a TXT DNS query using data from the passed peer_info_t structure. Upon success this buffer is re-cast as a char * and then a pointer to this memory is returned. Upon failure a NULL pointer is returned. Definition at line <a class="el" href="dns_8c-source.html#l00866">866</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
391     <p>
392     References <a class="el" href="main_8c-source.html#l00059">h_errno</a>, <a class="el" href="dns_8h-source.html#l00089">SPF_MAXCDNAME</a>, <a class="el" href="util_8h-source.html#l00154">xepprintf</a>, <a class="el" href="util_8h-source.html#l00125">xmalloc</a>, <a class="el" href="util_8h-source.html#l00146">xpprintf</a>, <a class="el" href="util_8h-source.html#l00126">xrealloc</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
393     <p>
394     Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td>
395     </tr>
396     </table>
397     <a class="anchor" name="a10" doxytag="dns.h::DNS_mx_answer" ></a><p>
398     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
399     <tr>
400     <td class="mdRow">
401     <table cellpadding="0" cellspacing="0" border="0">
402     <tr>
403     <td class="md" nowrap valign="top"> char* DNS_mx_answer </td>
404     <td class="md" valign="top">(&nbsp;</td>
405     <td class="md" nowrap valign="top">int16_t&nbsp;</td>
406     <td class="mdname" nowrap> <em>ancount</em>, </td>
407     </tr>
408     <tr>
409     <td class="md" nowrap align="right"></td>
410     <td></td>
411     <td class="md" nowrap>const u_char *&nbsp;</td>
412     <td class="mdname" nowrap> <em>msg_ptr</em>, </td>
413     </tr>
414     <tr>
415     <td class="md" nowrap align="right"></td>
416     <td></td>
417     <td class="md" nowrap>const u_char *&nbsp;</td>
418     <td class="mdname" nowrap> <em>eom_ptr</em>, </td>
419     </tr>
420     <tr>
421     <td class="md" nowrap align="right"></td>
422     <td></td>
423     <td class="md" nowrap>u_char *&nbsp;</td>
424     <td class="mdname" nowrap> <em>rd_ptr</em>, </td>
425     </tr>
426     <tr>
427     <td class="md" nowrap align="right"></td>
428     <td></td>
429     <td class="md" nowrap>char *&nbsp;</td>
430     <td class="mdname" nowrap> <em>buf</em>, </td>
431     </tr>
432     <tr>
433     <td class="md" nowrap align="right"></td>
434     <td></td>
435     <td class="md" nowrap>int *&nbsp;</td>
436     <td class="mdname" nowrap> <em>ttl</em></td>
437     </tr>
438     <tr>
439     <td></td>
440     <td class="md">)&nbsp;</td>
441     <td class="md" colspan="2"></td>
442     </tr>
443     </table>
444     </td>
445     </tr>
446     </table>
447     <table cellspacing=5 cellpadding=0 border=0>
448     <tr>
449     <td>
450     &nbsp;
451     </td>
452     <td>
453    
454     <p>
455     Process a DNS message of type T_MX.
456     <p>
457     <dl compact><dt><b>Parameters:</b></dt><dd>
458     <table border="0" cellspacing="2" cellpadding="0">
459     <tr><td></td><td valign=top><em>ancount</em>&nbsp;</td><td>Answer count </td></tr>
460     <tr><td></td><td valign=top><em>msg_ptr</em>&nbsp;</td><td>DNS message </td></tr>
461     <tr><td></td><td valign=top><em>eom_ptr</em>&nbsp;</td><td>Pointer to the end of the DNS message </td></tr>
462     <tr><td></td><td valign=top><em>rd_ptr</em>&nbsp;</td><td>Pointer to a position in the DNS message </td></tr>
463     <tr><td></td><td valign=top><em>buf</em>&nbsp;</td><td>Utiltiy buffer </td></tr>
464     <tr><td></td><td valign=top><em>ttl</em>&nbsp;</td><td>Time To Live value of the DNS message </td></tr>
465     </table>
466     </dl>
467     Author: James Couzens &lt;<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>&gt;<br>
468     <p>
469     Date: 01/02/04<br>
470     Date: 02/20/04 - Added cache by Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
471     <p>
472     Desc: SPF_PACKETSZ bytes are allocated and then filled with chars. This buffer is then used in an MX DNS query using data from the passed peer_info_t structure. Upon success this buffer is re-cast as a char * and then a pointer to this memory is returned. Upon failure a NULL pointer is returned. Definition at line <a class="el" href="dns_8c-source.html#l00611">611</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
473     <p>
474     References <a class="el" href="main_8c-source.html#l00059">h_errno</a>, <a class="el" href="dns_8h-source.html#l00089">SPF_MAXCDNAME</a>, <a class="el" href="util_8h-source.html#l00125">xmalloc</a>, <a class="el" href="util_8h-source.html#l00138">xprintf</a>, <a class="el" href="util_8h-source.html#l00126">xrealloc</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
475     <p>
476     Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td>
477     </tr>
478     </table>
479     <a class="anchor" name="a11" doxytag="dns.h::DNS_ptr_answer" ></a><p>
480     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
481     <tr>
482     <td class="mdRow">
483     <table cellpadding="0" cellspacing="0" border="0">
484     <tr>
485     <td class="md" nowrap valign="top"> <a class="el" href="spf_8h.html#a35">SPF_BOOL</a> DNS_ptr_answer </td>
486     <td class="md" valign="top">(&nbsp;</td>
487     <td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> *&nbsp;</td>
488     <td class="mdname" nowrap> <em>p</em>, </td>
489     </tr>
490     <tr>
491     <td class="md" nowrap align="right"></td>
492     <td></td>
493     <td class="md" nowrap>int16_t&nbsp;</td>
494     <td class="mdname" nowrap> <em>ancount</em>, </td>
495     </tr>
496     <tr>
497     <td class="md" nowrap align="right"></td>
498     <td></td>
499     <td class="md" nowrap>const u_char *&nbsp;</td>
500     <td class="mdname" nowrap> <em>msg_ptr</em>, </td>
501     </tr>
502     <tr>
503     <td class="md" nowrap align="right"></td>
504     <td></td>
505     <td class="md" nowrap>const u_char *&nbsp;</td>
506     <td class="mdname" nowrap> <em>eom_ptr</em>, </td>
507     </tr>
508     <tr>
509     <td class="md" nowrap align="right"></td>
510     <td></td>
511     <td class="md" nowrap>u_char *&nbsp;</td>
512     <td class="mdname" nowrap> <em>rd_ptr</em>, </td>
513     </tr>
514     <tr>
515     <td class="md" nowrap align="right"></td>
516     <td></td>
517     <td class="md" nowrap>char *&nbsp;</td>
518     <td class="mdname" nowrap> <em>buf</em>, </td>
519     </tr>
520     <tr>
521     <td class="md" nowrap align="right"></td>
522     <td></td>
523     <td class="md" nowrap>const char *&nbsp;</td>
524     <td class="mdname" nowrap> <em>mta</em>, </td>
525     </tr>
526     <tr>
527     <td class="md" nowrap align="right"></td>
528     <td></td>
529     <td class="md" nowrap>int *&nbsp;</td>
530     <td class="mdname" nowrap> <em>ttl</em></td>
531     </tr>
532     <tr>
533     <td></td>
534     <td class="md">)&nbsp;</td>
535     <td class="md" colspan="2"></td>
536     </tr>
537     </table>
538     </td>
539     </tr>
540     </table>
541     <table cellspacing=5 cellpadding=0 border=0>
542     <tr>
543     <td>
544     &nbsp;
545     </td>
546     <td>
547    
548     <p>
549     Process a DNS message of type T_PTR.
550     <p>
551     <dl compact><dt><b>Parameters:</b></dt><dd>
552     <table border="0" cellspacing="2" cellpadding="0">
553     <tr><td></td><td valign=top><em>p</em>&nbsp;</td><td>Global information structure containing client information </td></tr>
554     <tr><td></td><td valign=top><em>ancount</em>&nbsp;</td><td>Answer count </td></tr>
555     <tr><td></td><td valign=top><em>msg_ptr</em>&nbsp;</td><td>DNS message </td></tr>
556     <tr><td></td><td valign=top><em>eom_ptr</em>&nbsp;</td><td>Pointer to the end of the DNS message </td></tr>
557     <tr><td></td><td valign=top><em>rd_ptr</em>&nbsp;</td><td>Pointer to a position in the DNS message </td></tr>
558     <tr><td></td><td valign=top><em>buf</em>&nbsp;</td><td>Utiltiy buffer </td></tr>
559     <tr><td></td><td valign=top><em>mta</em>&nbsp;</td><td>IP address of the authoritative MX </td></tr>
560     <tr><td></td><td valign=top><em>ttl</em>&nbsp;</td><td>Time To Live value of the DNS message </td></tr>
561     </table>
562     </dl>
563     Author: James Couzens &lt;<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>&gt;<br>
564     <p>
565     Date: 01/02/04<br>
566     Date: 02/20/04 - Added cache by Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
567     <p>
568     Desc: A reverse lookup on an IP address leads to a lookup per returned PTR answer to see if the returned answer matches. The forward lookups are handled by a separate function which calls gethostbyname. Upon a single successful match of a forward lookup with a reverse lookup, returns SPF_TRUE. Returns SPF_FALSE upon failure. Definition at line <a class="el" href="dns_8c-source.html#l00716">716</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
569     <p>
570     References <a class="el" href="main_8c-source.html#l00059">h_errno</a>, <a class="el" href="spf_8h.html#a46">peer_info_t</a>, <a class="el" href="spf_8h.html#a35">SPF_BOOL</a>, <a class="el" href="spf_8h.html#a87a49">SPF_FALSE</a>, <a class="el" href="dns_8h-source.html#l00089">SPF_MAXCDNAME</a>, <a class="el" href="spf_8h.html#a87a50">SPF_TRUE</a>, <a class="el" href="util_8c-source.html#l02100">UTIL_validate_hostname()</a>, <a class="el" href="util_8h-source.html#l00154">xepprintf</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
571     <p>
572     Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>.
573     <p>
574     Here is the call graph for this function:<p><center><img src="dns_8h_a11_cgraph.png" border="0" usemap="#dns_8h_a11_cgraph_map" alt=""></center>
575     <map name="dns_8h_a11_cgraph_map">
576     <area href="util_8h.html#a54" shape="rect" coords="181,26,339,45" alt="">
577     <area href="util_8h.html#a47" shape="rect" coords="389,5,509,24" alt="">
578     <area href="util_8h.html#a52" shape="rect" coords="399,48,500,66" alt="">
579     <area href="util_8h.html#a35" shape="rect" coords="559,5,639,24" alt="">
580     </map>
581     </td>
582     </tr>
583     </table>
584     <a class="anchor" name="a8" doxytag="dns.h::DNS_query" ></a><p>
585     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
586     <tr>
587     <td class="mdRow">
588     <table cellpadding="0" cellspacing="0" border="0">
589     <tr>
590     <td class="md" nowrap valign="top"> char* DNS_query </td>
591     <td class="md" valign="top">(&nbsp;</td>
592     <td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> *&nbsp;</td>
593     <td class="mdname" nowrap> <em>p</em>, </td>
594     </tr>
595     <tr>
596     <td class="md" nowrap align="right"></td>
597     <td></td>
598     <td class="md" nowrap>const char *&nbsp;</td>
599     <td class="mdname" nowrap> <em>s</em>, </td>
600     </tr>
601     <tr>
602     <td class="md" nowrap align="right"></td>
603     <td></td>
604     <td class="md" nowrap>const int&nbsp;</td>
605     <td class="mdname" nowrap> <em>T_TYPE</em>, </td>
606     </tr>
607     <tr>
608     <td class="md" nowrap align="right"></td>
609     <td></td>
610     <td class="md" nowrap>const char *&nbsp;</td>
611     <td class="mdname" nowrap> <em>mta</em></td>
612     </tr>
613     <tr>
614     <td></td>
615     <td class="md">)&nbsp;</td>
616     <td class="md" colspan="2"></td>
617     </tr>
618     </table>
619     </td>
620     </tr>
621     </table>
622     <table cellspacing=5 cellpadding=0 border=0>
623     <tr>
624     <td>
625     &nbsp;
626     </td>
627     <td>
628    
629     <p>
630     Execute a DNS query.
631     <p>
632     <dl compact><dt><b>Parameters:</b></dt><dd>
633     <table border="0" cellspacing="2" cellpadding="0">
634     <tr><td></td><td valign=top><em>p</em>&nbsp;</td><td>Global information structure containing client information </td></tr>
635     <tr><td></td><td valign=top><em>s</em>&nbsp;</td><td>Domain name with which to perform the query against </td></tr>
636     <tr><td></td><td valign=top><em>T_TYPE</em>&nbsp;</td><td>Type of DNS record to lookup (eg: T_TXT, T_PTR, T_A, etc..) </td></tr>
637     <tr><td></td><td valign=top><em>mta</em>&nbsp;</td><td>Used by DNS_ptr_answer in validation of an SPF ptr mechanism </td></tr>
638     </table>
639     </dl>
640     Author: James Couzens &lt;<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>&gt;<br>
641     Author: Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
642     <p>
643     Date: 12/10/03<br>
644     Date: 02/20/04 - Added cache by Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
645     <p>
646     Desc: Executes a DNS query of type T_TYPE and then calls the appropriate answer parsing function based on that type. Returns a pointer to allocated memory (a string of space delimited records). Upon failure returns NULL. Definition at line <a class="el" href="dns_8c-source.html#l00217">217</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
647     <p>
648     References <a class="el" href="dns_8c-source.html#l00866">DNS_cname_answer()</a>, <a class="el" href="dns_8c-source.html#l00611">DNS_mx_answer()</a>, <a class="el" href="dns_8c-source.html#l00716">DNS_ptr_answer()</a>, <a class="el" href="dns_8c-source.html#l00419">DNS_txt_answer()</a>, <a class="el" href="spf_8h-source.html#l00359">peer_info_s::error</a>, <a class="el" href="main_8c-source.html#l00059">h_errno</a>, <a class="el" href="spf_8h.html#a46">peer_info_t</a>, <a class="el" href="spf_8h.html#a88a55">SPF_ERROR</a>, <a class="el" href="spf_8h.html#a87a49">SPF_FALSE</a>, <a class="el" href="spf_8h-source.html#l00085">SPF_MAX_ERROR</a>, <a class="el" href="dns_8h-source.html#l00088">SPF_MAXDNAME</a>, <a class="el" href="spf_8h.html#a88a52">SPF_NONE</a>, <a class="el" href="dns_8h-source.html#l00087">SPF_PACKETSZ</a>, <a class="el" href="spf_8h.html#a87a50">SPF_TRUE</a>, <a class="el" href="util_8c-source.html#l01309">UTIL_assoc_prefix()</a>, <a class="el" href="util_8h-source.html#l00154">xepprintf</a>, <a class="el" href="util_8h-source.html#l00138">xprintf</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
649     <p>
650     Referenced by <a class="el" href="main_8c-source.html#l00721">SPF_parse_policy()</a>, <a class="el" href="main_8c-source.html#l00570">SPF_policy_main_rec()</a>, <a class="el" href="util_8c-source.html#l00914">UTIL_mx_cmp()</a>, <a class="el" href="util_8c-source.html#l01135">UTIL_ptr_cmp()</a>, and <a class="el" href="util_8c-source.html#l02038">UTIL_validate_ptr()</a>.
651     <p>
652     Here is the call graph for this function:<p><center><img src="dns_8h_a8_cgraph.png" border="0" usemap="#dns_8h_a8_cgraph_map" alt=""></center>
653     <map name="dns_8h_a8_cgraph_map">
654     <area href="dns_8h.html#a12" shape="rect" coords="149,5,288,24" alt="">
655     <area href="dns_8h.html#a10" shape="rect" coords="160,48,277,66" alt="">
656     <area href="dns_8h.html#a11" shape="rect" coords="163,90,275,109" alt="">
657     <area href="util_8h.html#a47" shape="rect" coords="547,134,667,153" alt="">
658     <area href="dns_8h.html#a9" shape="rect" coords="163,184,275,202" alt="">
659     <area href="util_8h.html#a54" shape="rect" coords="339,90,496,109" alt="">
660     <area href="util_8h.html#a52" shape="rect" coords="556,90,657,109" alt="">
661     <area href="util_8h.html#a35" shape="rect" coords="716,134,796,153" alt="">
662     </map>
663     </td>
664     </tr>
665     </table>
666     <a class="anchor" name="a9" doxytag="dns.h::DNS_txt_answer" ></a><p>
667     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
668     <tr>
669     <td class="mdRow">
670     <table cellpadding="0" cellspacing="0" border="0">
671     <tr>
672     <td class="md" nowrap valign="top"> char* DNS_txt_answer </td>
673     <td class="md" valign="top">(&nbsp;</td>
674     <td class="md" nowrap valign="top">int16_t&nbsp;</td>
675     <td class="mdname" nowrap> <em>ancount</em>, </td>
676     </tr>
677     <tr>
678     <td class="md" nowrap align="right"></td>
679     <td></td>
680     <td class="md" nowrap>const u_char *&nbsp;</td>
681     <td class="mdname" nowrap> <em>msg_ptr</em>, </td>
682     </tr>
683     <tr>
684     <td class="md" nowrap align="right"></td>
685     <td></td>
686     <td class="md" nowrap>const u_char *&nbsp;</td>
687     <td class="mdname" nowrap> <em>eom_ptr</em>, </td>
688     </tr>
689     <tr>
690     <td class="md" nowrap align="right"></td>
691     <td></td>
692     <td class="md" nowrap>u_char *&nbsp;</td>
693     <td class="mdname" nowrap> <em>rd_ptr</em>, </td>
694     </tr>
695     <tr>
696     <td class="md" nowrap align="right"></td>
697     <td></td>
698     <td class="md" nowrap>char *&nbsp;</td>
699     <td class="mdname" nowrap> <em>buf</em>, </td>
700     </tr>
701     <tr>
702     <td class="md" nowrap align="right"></td>
703     <td></td>
704     <td class="md" nowrap>int *&nbsp;</td>
705     <td class="mdname" nowrap> <em>ttl</em></td>
706     </tr>
707     <tr>
708     <td></td>
709     <td class="md">)&nbsp;</td>
710     <td class="md" colspan="2"></td>
711     </tr>
712     </table>
713     </td>
714     </tr>
715     </table>
716     <table cellspacing=5 cellpadding=0 border=0>
717     <tr>
718     <td>
719     &nbsp;
720     </td>
721     <td>
722    
723     <p>
724     Process a DNS message of type T_TXT.
725     <p>
726     <dl compact><dt><b>Parameters:</b></dt><dd>
727     <table border="0" cellspacing="2" cellpadding="0">
728     <tr><td></td><td valign=top><em>ancount</em>&nbsp;</td><td>Answer count </td></tr>
729     <tr><td></td><td valign=top><em>msg_ptr</em>&nbsp;</td><td>DNS message </td></tr>
730     <tr><td></td><td valign=top><em>eom_ptr</em>&nbsp;</td><td>Pointer to the end of the DNS message </td></tr>
731     <tr><td></td><td valign=top><em>rd_ptr</em>&nbsp;</td><td>Pointer to a position in the DNS message </td></tr>
732     <tr><td></td><td valign=top><em>buf</em>&nbsp;</td><td>Utiltiy buffer </td></tr>
733     <tr><td></td><td valign=top><em>ttl</em>&nbsp;</td><td>Time To Live value of the DNS message </td></tr>
734     </table>
735     </dl>
736     Author: James Couzens &lt;<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>&gt;<br>
737     <p>
738     Date: 01/02/04<br>
739     Date: 02/23/04 - Bugfix from Albert Weichselbraun &lt;<a href="mailto:albert@atnet.at">albert@atnet.at</a>&gt;<br>
740     Date: 02/20/04 - Added cache by Travis Anderson &lt;<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>&gt;<br>
741     <p>
742     Desc: SPF_PACKETSZ bytes are allocated and then filled with chars. This buffer is then used in a TXT DNS query using data from the passed peer_info_t structure. Upon success this buffer is re-cast as a char * and then a pointer to this memory is returned. Upon failure a NULL pointer is returned. Definition at line <a class="el" href="dns_8c-source.html#l00419">419</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.
743     <p>
744     References <a class="el" href="main_8c-source.html#l00059">h_errno</a>, <a class="el" href="spf_8h-source.html#l00072">SPF_MAX_STR</a>, <a class="el" href="dns_8h-source.html#l00089">SPF_MAXCDNAME</a>, <a class="el" href="util_8h-source.html#l00154">xepprintf</a>, <a class="el" href="util_8h-source.html#l00127">xfree</a>, <a class="el" href="util_8h-source.html#l00125">xmalloc</a>, <a class="el" href="util_8h-source.html#l00146">xpprintf</a>, <a class="el" href="util_8h-source.html#l00126">xrealloc</a>, <a class="el" href="util_8h-source.html#l00129">xstrndup</a>, and <a class="el" href="util_8h-source.html#l00142">xvprintf</a>.
745     <p>
746     Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td>
747     </tr>
748     </table>
749     <hr><h2>Variable Documentation</h2>
750     <a class="anchor" name="a6" doxytag="dns.h::h_errno" ></a><p>
751     <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
752     <tr>
753     <td class="mdRow">
754     <table cellpadding="0" cellspacing="0" border="0">
755     <tr>
756     <td class="md" nowrap valign="top"> int <a class="el" href="main_8c.html#a1">h_errno</a> </td>
757     </tr>
758     </table>
759     </td>
760     </tr>
761     </table>
762     <table cellspacing=5 cellpadding=0 border=0>
763     <tr>
764     <td>
765     &nbsp;
766     </td>
767     <td>
768    
769     <p>
770     Definition at line <a class="el" href="main_8c-source.html#l00059">59</a> of file <a class="el" href="main_8c-source.html">main.c</a>.
771     <p>
772     Referenced by <a class="el" href="dns_8c-source.html#l00866">DNS_cname_answer()</a>, <a class="el" href="dns_8c-source.html#l00611">DNS_mx_answer()</a>, <a class="el" href="dns_8c-source.html#l00716">DNS_ptr_answer()</a>, <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>, and <a class="el" href="dns_8c-source.html#l00419">DNS_txt_answer()</a>. </td>
773     </tr>
774     </table>
775     <hr size="1"><address style="align: right;"><small>Generated on Thu Sep 16 18:10:47 2004 for libSPF v1.0 by
776     <a href="http://www.doxygen.org/index.html">
777     <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address>
778     </body>
779     </html>