| 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.c 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 Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> |
| 9 |
<h1>dns.c File Reference</h1>DNS Functions. <a href="#_details">More...</a> |
| 10 |
<p> |
| 11 |
<code>#include "<a class="el" href="spf_8h-source.html">spf.h</a>"</code><br> |
| 12 |
<code>#include "<a class="el" href="util_8h-source.html">util.h</a>"</code><br> |
| 13 |
<code>#include "<a class="el" href="dns_8h-source.html">dns.h</a>"</code><br> |
| 14 |
<code>#include "../../config.h"</code><br> |
| 15 |
|
| 16 |
<p> |
| 17 |
Include dependency graph for dns.c:<p><center><img src="dns_8c__incl.png" border="0" usemap="#dns.c_map" alt="Include dependency graph"></center> |
| 18 |
<map name="dns.c_map"> |
| 19 |
<area href="spf_8h.html" shape="rect" coords="7,86,44,105" alt=""> |
| 20 |
<area href="util_8h.html" shape="rect" coords="119,86,156,105" alt=""> |
| 21 |
<area href="dns_8h.html" shape="rect" coords="180,86,223,105" alt=""> |
| 22 |
</map> |
| 23 |
|
| 24 |
<p> |
| 25 |
<a href="dns_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0> |
| 26 |
<tr><td></td></tr> |
| 27 |
<tr><td colspan=2><br><h2>Functions</h2></td></tr> |
| 28 |
<tr><td class="memItemLeft" nowrap align=right valign=top>char * </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a1">DNS_query</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *p, const char *s, const int T_TYPE, const char *mta)</td></tr> |
| 29 |
|
| 30 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Execute a DNS query. <a href="#a1"></a><br></td></tr> |
| 31 |
<tr><td class="memItemLeft" nowrap align=right valign=top>char * </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a2">DNS_txt_answer</a> (int16_t ancount, const u_char *msg_ptr, const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl)</td></tr> |
| 32 |
|
| 33 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Process a DNS message of type T_TXT. <a href="#a2"></a><br></td></tr> |
| 34 |
<tr><td class="memItemLeft" nowrap align=right valign=top>char * </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a3">DNS_mx_answer</a> (int16_t ancount, const u_char *msg_ptr, const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl)</td></tr> |
| 35 |
|
| 36 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Process a DNS message of type T_MX. <a href="#a3"></a><br></td></tr> |
| 37 |
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="spf_8h.html#a35">SPF_BOOL</a> </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a4">DNS_ptr_answer</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *p, int16_t ancount, const u_char *msg_ptr, const u_char *eom_ptr, u_char *rd_ptr, char *buf, const char *mta, int *ttl)</td></tr> |
| 38 |
|
| 39 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Process a DNS message of type T_PTR. <a href="#a4"></a><br></td></tr> |
| 40 |
<tr><td class="memItemLeft" nowrap align=right valign=top>char * </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a5">DNS_cname_answer</a> (int16_t ancount, const u_char *msg_ptr, const u_char *eom_ptr, u_char *rd_ptr, char *buf, int *ttl)</td></tr> |
| 41 |
|
| 42 |
<tr><td class="mdescLeft"> </td><td class="mdescRight">Process a DNS message of type T_MX. <a href="#a5"></a><br></td></tr> |
| 43 |
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="spf_8h.html#a35">SPF_BOOL</a> </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a6">DNS_check_client_reverse</a> (<a class="el" href="structpeer__info__s.html">peer_info_t</a> *p)</td></tr> |
| 44 |
|
| 45 |
<tr><td colspan=2><br><h2>Variables</h2></td></tr> |
| 46 |
<tr><td class="memItemLeft" nowrap align=right valign=top>void * </td><td class="memItemRight" valign=bottom><a class="el" href="dns_8c.html#a0">dns_mutex</a></td></tr> |
| 47 |
|
| 48 |
</table> |
| 49 |
<hr><a name="_details"></a><h2>Detailed Description</h2> |
| 50 |
DNS Functions. |
| 51 |
<p> |
| 52 |
<a class="el" href="dns_8c.html">dns.c</a> contains functions relating to the execution and processing of DNS queries. Each particular DNS record type has a unique function that is designed to process such a response. |
| 53 |
<p> |
| 54 |
Definition in file <a class="el" href="dns_8c-source.html">dns.c</a>.<hr><h2>Function Documentation</h2> |
| 55 |
<a class="anchor" name="a6" doxytag="dns.c::DNS_check_client_reverse" ></a><p> |
| 56 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 57 |
<tr> |
| 58 |
<td class="mdRow"> |
| 59 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 60 |
<tr> |
| 61 |
<td class="md" nowrap valign="top"> <a class="el" href="spf_8h.html#a35">SPF_BOOL</a> DNS_check_client_reverse </td> |
| 62 |
<td class="md" valign="top">( </td> |
| 63 |
<td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> * </td> |
| 64 |
<td class="mdname1" valign="top" nowrap> <em>p</em> </td> |
| 65 |
<td class="md" valign="top"> ) </td> |
| 66 |
<td class="md" nowrap></td> |
| 67 |
</tr> |
| 68 |
</table> |
| 69 |
</td> |
| 70 |
</tr> |
| 71 |
</table> |
| 72 |
<table cellspacing=5 cellpadding=0 border=0> |
| 73 |
<tr> |
| 74 |
<td> |
| 75 |
|
| 76 |
</td> |
| 77 |
<td> |
| 78 |
|
| 79 |
<p> |
| 80 |
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>. |
| 81 |
<p> |
| 82 |
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>. |
| 83 |
<p> |
| 84 |
Referenced by <a class="el" href="macro_8c-source.html#l00301">MACRO_process()</a>. |
| 85 |
<p> |
| 86 |
Here is the call graph for this function:<p><center><img src="dns_8c_a6_cgraph.png" border="0" usemap="#dns_8c_a6_cgraph_map" alt=""></center> |
| 87 |
<map name="dns_8c_a6_cgraph_map"> |
| 88 |
<area href="util_8h.html#a50" shape="rect" coords="271,5,372,23" alt=""> |
| 89 |
<area href="util_8h.html#a54" shape="rect" coords="243,47,400,66" alt=""> |
| 90 |
<area href="util_8h.html#a47" shape="rect" coords="451,26,571,45" alt=""> |
| 91 |
<area href="util_8h.html#a52" shape="rect" coords="460,69,561,87" alt=""> |
| 92 |
<area href="util_8h.html#a35" shape="rect" coords="620,26,700,45" alt=""> |
| 93 |
</map> |
| 94 |
</td> |
| 95 |
</tr> |
| 96 |
</table> |
| 97 |
<a class="anchor" name="a5" doxytag="dns.c::DNS_cname_answer" ></a><p> |
| 98 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 99 |
<tr> |
| 100 |
<td class="mdRow"> |
| 101 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 102 |
<tr> |
| 103 |
<td class="md" nowrap valign="top"> char * DNS_cname_answer </td> |
| 104 |
<td class="md" valign="top">( </td> |
| 105 |
<td class="md" nowrap valign="top">int16_t </td> |
| 106 |
<td class="mdname" nowrap> <em>ancount</em>, </td> |
| 107 |
</tr> |
| 108 |
<tr> |
| 109 |
<td class="md" nowrap align="right"></td> |
| 110 |
<td></td> |
| 111 |
<td class="md" nowrap>const u_char * </td> |
| 112 |
<td class="mdname" nowrap> <em>msg_ptr</em>, </td> |
| 113 |
</tr> |
| 114 |
<tr> |
| 115 |
<td class="md" nowrap align="right"></td> |
| 116 |
<td></td> |
| 117 |
<td class="md" nowrap>const u_char * </td> |
| 118 |
<td class="mdname" nowrap> <em>eom_ptr</em>, </td> |
| 119 |
</tr> |
| 120 |
<tr> |
| 121 |
<td class="md" nowrap align="right"></td> |
| 122 |
<td></td> |
| 123 |
<td class="md" nowrap>u_char * </td> |
| 124 |
<td class="mdname" nowrap> <em>rd_ptr</em>, </td> |
| 125 |
</tr> |
| 126 |
<tr> |
| 127 |
<td class="md" nowrap align="right"></td> |
| 128 |
<td></td> |
| 129 |
<td class="md" nowrap>char * </td> |
| 130 |
<td class="mdname" nowrap> <em>buf</em>, </td> |
| 131 |
</tr> |
| 132 |
<tr> |
| 133 |
<td class="md" nowrap align="right"></td> |
| 134 |
<td></td> |
| 135 |
<td class="md" nowrap>int * </td> |
| 136 |
<td class="mdname" nowrap> <em>ttl</em></td> |
| 137 |
</tr> |
| 138 |
<tr> |
| 139 |
<td></td> |
| 140 |
<td class="md">) </td> |
| 141 |
<td class="md" colspan="2"></td> |
| 142 |
</tr> |
| 143 |
</table> |
| 144 |
</td> |
| 145 |
</tr> |
| 146 |
</table> |
| 147 |
<table cellspacing=5 cellpadding=0 border=0> |
| 148 |
<tr> |
| 149 |
<td> |
| 150 |
|
| 151 |
</td> |
| 152 |
<td> |
| 153 |
|
| 154 |
<p> |
| 155 |
Process a DNS message of type T_MX. |
| 156 |
<p> |
| 157 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 158 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 159 |
<tr><td></td><td valign=top><em>ancount</em> </td><td>Answer count </td></tr> |
| 160 |
<tr><td></td><td valign=top><em>msg_ptr</em> </td><td>DNS message </td></tr> |
| 161 |
<tr><td></td><td valign=top><em>eom_ptr</em> </td><td>Pointer to the end of the DNS message </td></tr> |
| 162 |
<tr><td></td><td valign=top><em>rd_ptr</em> </td><td>Pointer to a position in the DNS message </td></tr> |
| 163 |
<tr><td></td><td valign=top><em>buf</em> </td><td>Utiltiy buffer </td></tr> |
| 164 |
<tr><td></td><td valign=top><em>ttl</em> </td><td>Time To Live value of the DNS message </td></tr> |
| 165 |
</table> |
| 166 |
</dl> |
| 167 |
Author: Teddy <<a href="mailto:teddy@teddy.ch">teddy@teddy.ch</a>><br> |
| 168 |
<p> |
| 169 |
Date: 29/04/04<br> |
| 170 |
Date: 02/20/04 - Added cache by Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 171 |
<p> |
| 172 |
Desc:<br> |
| 173 |
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>. |
| 174 |
<p> |
| 175 |
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>. |
| 176 |
<p> |
| 177 |
Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td> |
| 178 |
</tr> |
| 179 |
</table> |
| 180 |
<a class="anchor" name="a3" doxytag="dns.c::DNS_mx_answer" ></a><p> |
| 181 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 182 |
<tr> |
| 183 |
<td class="mdRow"> |
| 184 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 185 |
<tr> |
| 186 |
<td class="md" nowrap valign="top"> char * DNS_mx_answer </td> |
| 187 |
<td class="md" valign="top">( </td> |
| 188 |
<td class="md" nowrap valign="top">int16_t </td> |
| 189 |
<td class="mdname" nowrap> <em>ancount</em>, </td> |
| 190 |
</tr> |
| 191 |
<tr> |
| 192 |
<td class="md" nowrap align="right"></td> |
| 193 |
<td></td> |
| 194 |
<td class="md" nowrap>const u_char * </td> |
| 195 |
<td class="mdname" nowrap> <em>msg_ptr</em>, </td> |
| 196 |
</tr> |
| 197 |
<tr> |
| 198 |
<td class="md" nowrap align="right"></td> |
| 199 |
<td></td> |
| 200 |
<td class="md" nowrap>const u_char * </td> |
| 201 |
<td class="mdname" nowrap> <em>eom_ptr</em>, </td> |
| 202 |
</tr> |
| 203 |
<tr> |
| 204 |
<td class="md" nowrap align="right"></td> |
| 205 |
<td></td> |
| 206 |
<td class="md" nowrap>u_char * </td> |
| 207 |
<td class="mdname" nowrap> <em>rd_ptr</em>, </td> |
| 208 |
</tr> |
| 209 |
<tr> |
| 210 |
<td class="md" nowrap align="right"></td> |
| 211 |
<td></td> |
| 212 |
<td class="md" nowrap>char * </td> |
| 213 |
<td class="mdname" nowrap> <em>buf</em>, </td> |
| 214 |
</tr> |
| 215 |
<tr> |
| 216 |
<td class="md" nowrap align="right"></td> |
| 217 |
<td></td> |
| 218 |
<td class="md" nowrap>int * </td> |
| 219 |
<td class="mdname" nowrap> <em>ttl</em></td> |
| 220 |
</tr> |
| 221 |
<tr> |
| 222 |
<td></td> |
| 223 |
<td class="md">) </td> |
| 224 |
<td class="md" colspan="2"></td> |
| 225 |
</tr> |
| 226 |
</table> |
| 227 |
</td> |
| 228 |
</tr> |
| 229 |
</table> |
| 230 |
<table cellspacing=5 cellpadding=0 border=0> |
| 231 |
<tr> |
| 232 |
<td> |
| 233 |
|
| 234 |
</td> |
| 235 |
<td> |
| 236 |
|
| 237 |
<p> |
| 238 |
Process a DNS message of type T_MX. |
| 239 |
<p> |
| 240 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 241 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 242 |
<tr><td></td><td valign=top><em>ancount</em> </td><td>Answer count </td></tr> |
| 243 |
<tr><td></td><td valign=top><em>msg_ptr</em> </td><td>DNS message </td></tr> |
| 244 |
<tr><td></td><td valign=top><em>eom_ptr</em> </td><td>Pointer to the end of the DNS message </td></tr> |
| 245 |
<tr><td></td><td valign=top><em>rd_ptr</em> </td><td>Pointer to a position in the DNS message </td></tr> |
| 246 |
<tr><td></td><td valign=top><em>buf</em> </td><td>Utiltiy buffer </td></tr> |
| 247 |
<tr><td></td><td valign=top><em>ttl</em> </td><td>Time To Live value of the DNS message </td></tr> |
| 248 |
</table> |
| 249 |
</dl> |
| 250 |
Author: James Couzens <<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>><br> |
| 251 |
<p> |
| 252 |
Date: 01/02/04<br> |
| 253 |
Date: 02/20/04 - Added cache by Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 254 |
<p> |
| 255 |
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>. |
| 256 |
<p> |
| 257 |
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>. |
| 258 |
<p> |
| 259 |
Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td> |
| 260 |
</tr> |
| 261 |
</table> |
| 262 |
<a class="anchor" name="a4" doxytag="dns.c::DNS_ptr_answer" ></a><p> |
| 263 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 264 |
<tr> |
| 265 |
<td class="mdRow"> |
| 266 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 267 |
<tr> |
| 268 |
<td class="md" nowrap valign="top"> <a class="el" href="spf_8h.html#a35">SPF_BOOL</a> DNS_ptr_answer </td> |
| 269 |
<td class="md" valign="top">( </td> |
| 270 |
<td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> * </td> |
| 271 |
<td class="mdname" nowrap> <em>p</em>, </td> |
| 272 |
</tr> |
| 273 |
<tr> |
| 274 |
<td class="md" nowrap align="right"></td> |
| 275 |
<td></td> |
| 276 |
<td class="md" nowrap>int16_t </td> |
| 277 |
<td class="mdname" nowrap> <em>ancount</em>, </td> |
| 278 |
</tr> |
| 279 |
<tr> |
| 280 |
<td class="md" nowrap align="right"></td> |
| 281 |
<td></td> |
| 282 |
<td class="md" nowrap>const u_char * </td> |
| 283 |
<td class="mdname" nowrap> <em>msg_ptr</em>, </td> |
| 284 |
</tr> |
| 285 |
<tr> |
| 286 |
<td class="md" nowrap align="right"></td> |
| 287 |
<td></td> |
| 288 |
<td class="md" nowrap>const u_char * </td> |
| 289 |
<td class="mdname" nowrap> <em>eom_ptr</em>, </td> |
| 290 |
</tr> |
| 291 |
<tr> |
| 292 |
<td class="md" nowrap align="right"></td> |
| 293 |
<td></td> |
| 294 |
<td class="md" nowrap>u_char * </td> |
| 295 |
<td class="mdname" nowrap> <em>rd_ptr</em>, </td> |
| 296 |
</tr> |
| 297 |
<tr> |
| 298 |
<td class="md" nowrap align="right"></td> |
| 299 |
<td></td> |
| 300 |
<td class="md" nowrap>char * </td> |
| 301 |
<td class="mdname" nowrap> <em>buf</em>, </td> |
| 302 |
</tr> |
| 303 |
<tr> |
| 304 |
<td class="md" nowrap align="right"></td> |
| 305 |
<td></td> |
| 306 |
<td class="md" nowrap>const char * </td> |
| 307 |
<td class="mdname" nowrap> <em>mta</em>, </td> |
| 308 |
</tr> |
| 309 |
<tr> |
| 310 |
<td class="md" nowrap align="right"></td> |
| 311 |
<td></td> |
| 312 |
<td class="md" nowrap>int * </td> |
| 313 |
<td class="mdname" nowrap> <em>ttl</em></td> |
| 314 |
</tr> |
| 315 |
<tr> |
| 316 |
<td></td> |
| 317 |
<td class="md">) </td> |
| 318 |
<td class="md" colspan="2"></td> |
| 319 |
</tr> |
| 320 |
</table> |
| 321 |
</td> |
| 322 |
</tr> |
| 323 |
</table> |
| 324 |
<table cellspacing=5 cellpadding=0 border=0> |
| 325 |
<tr> |
| 326 |
<td> |
| 327 |
|
| 328 |
</td> |
| 329 |
<td> |
| 330 |
|
| 331 |
<p> |
| 332 |
Process a DNS message of type T_PTR. |
| 333 |
<p> |
| 334 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 335 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 336 |
<tr><td></td><td valign=top><em>p</em> </td><td>Global information structure containing client information </td></tr> |
| 337 |
<tr><td></td><td valign=top><em>ancount</em> </td><td>Answer count </td></tr> |
| 338 |
<tr><td></td><td valign=top><em>msg_ptr</em> </td><td>DNS message </td></tr> |
| 339 |
<tr><td></td><td valign=top><em>eom_ptr</em> </td><td>Pointer to the end of the DNS message </td></tr> |
| 340 |
<tr><td></td><td valign=top><em>rd_ptr</em> </td><td>Pointer to a position in the DNS message </td></tr> |
| 341 |
<tr><td></td><td valign=top><em>buf</em> </td><td>Utiltiy buffer </td></tr> |
| 342 |
<tr><td></td><td valign=top><em>mta</em> </td><td>IP address of the authoritative MX </td></tr> |
| 343 |
<tr><td></td><td valign=top><em>ttl</em> </td><td>Time To Live value of the DNS message </td></tr> |
| 344 |
</table> |
| 345 |
</dl> |
| 346 |
Author: James Couzens <<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>><br> |
| 347 |
<p> |
| 348 |
Date: 01/02/04<br> |
| 349 |
Date: 02/20/04 - Added cache by Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 350 |
<p> |
| 351 |
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>. |
| 352 |
<p> |
| 353 |
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>. |
| 354 |
<p> |
| 355 |
Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. |
| 356 |
<p> |
| 357 |
Here is the call graph for this function:<p><center><img src="dns_8c_a4_cgraph.png" border="0" usemap="#dns_8c_a4_cgraph_map" alt=""></center> |
| 358 |
<map name="dns_8c_a4_cgraph_map"> |
| 359 |
<area href="util_8h.html#a54" shape="rect" coords="181,26,339,45" alt=""> |
| 360 |
<area href="util_8h.html#a47" shape="rect" coords="389,5,509,24" alt=""> |
| 361 |
<area href="util_8h.html#a52" shape="rect" coords="399,48,500,66" alt=""> |
| 362 |
<area href="util_8h.html#a35" shape="rect" coords="559,5,639,24" alt=""> |
| 363 |
</map> |
| 364 |
</td> |
| 365 |
</tr> |
| 366 |
</table> |
| 367 |
<a class="anchor" name="a1" doxytag="dns.c::DNS_query" ></a><p> |
| 368 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 369 |
<tr> |
| 370 |
<td class="mdRow"> |
| 371 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 372 |
<tr> |
| 373 |
<td class="md" nowrap valign="top"> char * DNS_query </td> |
| 374 |
<td class="md" valign="top">( </td> |
| 375 |
<td class="md" nowrap valign="top"><a class="el" href="structpeer__info__s.html">peer_info_t</a> * </td> |
| 376 |
<td class="mdname" nowrap> <em>p</em>, </td> |
| 377 |
</tr> |
| 378 |
<tr> |
| 379 |
<td class="md" nowrap align="right"></td> |
| 380 |
<td></td> |
| 381 |
<td class="md" nowrap>const char * </td> |
| 382 |
<td class="mdname" nowrap> <em>s</em>, </td> |
| 383 |
</tr> |
| 384 |
<tr> |
| 385 |
<td class="md" nowrap align="right"></td> |
| 386 |
<td></td> |
| 387 |
<td class="md" nowrap>const int </td> |
| 388 |
<td class="mdname" nowrap> <em>T_TYPE</em>, </td> |
| 389 |
</tr> |
| 390 |
<tr> |
| 391 |
<td class="md" nowrap align="right"></td> |
| 392 |
<td></td> |
| 393 |
<td class="md" nowrap>const char * </td> |
| 394 |
<td class="mdname" nowrap> <em>mta</em></td> |
| 395 |
</tr> |
| 396 |
<tr> |
| 397 |
<td></td> |
| 398 |
<td class="md">) </td> |
| 399 |
<td class="md" colspan="2"></td> |
| 400 |
</tr> |
| 401 |
</table> |
| 402 |
</td> |
| 403 |
</tr> |
| 404 |
</table> |
| 405 |
<table cellspacing=5 cellpadding=0 border=0> |
| 406 |
<tr> |
| 407 |
<td> |
| 408 |
|
| 409 |
</td> |
| 410 |
<td> |
| 411 |
|
| 412 |
<p> |
| 413 |
Execute a DNS query. |
| 414 |
<p> |
| 415 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 416 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 417 |
<tr><td></td><td valign=top><em>p</em> </td><td>Global information structure containing client information </td></tr> |
| 418 |
<tr><td></td><td valign=top><em>s</em> </td><td>Domain name with which to perform the query against </td></tr> |
| 419 |
<tr><td></td><td valign=top><em>T_TYPE</em> </td><td>Type of DNS record to lookup (eg: T_TXT, T_PTR, T_A, etc..) </td></tr> |
| 420 |
<tr><td></td><td valign=top><em>mta</em> </td><td>Used by DNS_ptr_answer in validation of an SPF ptr mechanism </td></tr> |
| 421 |
</table> |
| 422 |
</dl> |
| 423 |
Author: James Couzens <<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>><br> |
| 424 |
Author: Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 425 |
<p> |
| 426 |
Date: 12/10/03<br> |
| 427 |
Date: 02/20/04 - Added cache by Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 428 |
<p> |
| 429 |
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>. |
| 430 |
<p> |
| 431 |
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>. |
| 432 |
<p> |
| 433 |
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>. |
| 434 |
<p> |
| 435 |
Here is the call graph for this function:<p><center><img src="dns_8c_a1_cgraph.png" border="0" usemap="#dns_8c_a1_cgraph_map" alt=""></center> |
| 436 |
<map name="dns_8c_a1_cgraph_map"> |
| 437 |
<area href="dns_8h.html#a12" shape="rect" coords="149,5,288,24" alt=""> |
| 438 |
<area href="dns_8h.html#a10" shape="rect" coords="160,48,277,66" alt=""> |
| 439 |
<area href="dns_8h.html#a11" shape="rect" coords="163,90,275,109" alt=""> |
| 440 |
<area href="util_8h.html#a47" shape="rect" coords="547,134,667,153" alt=""> |
| 441 |
<area href="dns_8h.html#a9" shape="rect" coords="163,184,275,202" alt=""> |
| 442 |
<area href="util_8h.html#a54" shape="rect" coords="339,90,496,109" alt=""> |
| 443 |
<area href="util_8h.html#a52" shape="rect" coords="556,90,657,109" alt=""> |
| 444 |
<area href="util_8h.html#a35" shape="rect" coords="716,134,796,153" alt=""> |
| 445 |
</map> |
| 446 |
</td> |
| 447 |
</tr> |
| 448 |
</table> |
| 449 |
<a class="anchor" name="a2" doxytag="dns.c::DNS_txt_answer" ></a><p> |
| 450 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 451 |
<tr> |
| 452 |
<td class="mdRow"> |
| 453 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 454 |
<tr> |
| 455 |
<td class="md" nowrap valign="top"> char * DNS_txt_answer </td> |
| 456 |
<td class="md" valign="top">( </td> |
| 457 |
<td class="md" nowrap valign="top">int16_t </td> |
| 458 |
<td class="mdname" nowrap> <em>ancount</em>, </td> |
| 459 |
</tr> |
| 460 |
<tr> |
| 461 |
<td class="md" nowrap align="right"></td> |
| 462 |
<td></td> |
| 463 |
<td class="md" nowrap>const u_char * </td> |
| 464 |
<td class="mdname" nowrap> <em>msg_ptr</em>, </td> |
| 465 |
</tr> |
| 466 |
<tr> |
| 467 |
<td class="md" nowrap align="right"></td> |
| 468 |
<td></td> |
| 469 |
<td class="md" nowrap>const u_char * </td> |
| 470 |
<td class="mdname" nowrap> <em>eom_ptr</em>, </td> |
| 471 |
</tr> |
| 472 |
<tr> |
| 473 |
<td class="md" nowrap align="right"></td> |
| 474 |
<td></td> |
| 475 |
<td class="md" nowrap>u_char * </td> |
| 476 |
<td class="mdname" nowrap> <em>rd_ptr</em>, </td> |
| 477 |
</tr> |
| 478 |
<tr> |
| 479 |
<td class="md" nowrap align="right"></td> |
| 480 |
<td></td> |
| 481 |
<td class="md" nowrap>char * </td> |
| 482 |
<td class="mdname" nowrap> <em>buf</em>, </td> |
| 483 |
</tr> |
| 484 |
<tr> |
| 485 |
<td class="md" nowrap align="right"></td> |
| 486 |
<td></td> |
| 487 |
<td class="md" nowrap>int * </td> |
| 488 |
<td class="mdname" nowrap> <em>ttl</em></td> |
| 489 |
</tr> |
| 490 |
<tr> |
| 491 |
<td></td> |
| 492 |
<td class="md">) </td> |
| 493 |
<td class="md" colspan="2"></td> |
| 494 |
</tr> |
| 495 |
</table> |
| 496 |
</td> |
| 497 |
</tr> |
| 498 |
</table> |
| 499 |
<table cellspacing=5 cellpadding=0 border=0> |
| 500 |
<tr> |
| 501 |
<td> |
| 502 |
|
| 503 |
</td> |
| 504 |
<td> |
| 505 |
|
| 506 |
<p> |
| 507 |
Process a DNS message of type T_TXT. |
| 508 |
<p> |
| 509 |
<dl compact><dt><b>Parameters:</b></dt><dd> |
| 510 |
<table border="0" cellspacing="2" cellpadding="0"> |
| 511 |
<tr><td></td><td valign=top><em>ancount</em> </td><td>Answer count </td></tr> |
| 512 |
<tr><td></td><td valign=top><em>msg_ptr</em> </td><td>DNS message </td></tr> |
| 513 |
<tr><td></td><td valign=top><em>eom_ptr</em> </td><td>Pointer to the end of the DNS message </td></tr> |
| 514 |
<tr><td></td><td valign=top><em>rd_ptr</em> </td><td>Pointer to a position in the DNS message </td></tr> |
| 515 |
<tr><td></td><td valign=top><em>buf</em> </td><td>Utiltiy buffer </td></tr> |
| 516 |
<tr><td></td><td valign=top><em>ttl</em> </td><td>Time To Live value of the DNS message </td></tr> |
| 517 |
</table> |
| 518 |
</dl> |
| 519 |
Author: James Couzens <<a href="mailto:jcouzens@codeshare.ca">jcouzens@codeshare.ca</a>><br> |
| 520 |
<p> |
| 521 |
Date: 01/02/04<br> |
| 522 |
Date: 02/23/04 - Bugfix from Albert Weichselbraun <<a href="mailto:albert@atnet.at">albert@atnet.at</a>><br> |
| 523 |
Date: 02/20/04 - Added cache by Travis Anderson <<a href="mailto:tanderson@codeshare.ca">tanderson@codeshare.ca</a>><br> |
| 524 |
<p> |
| 525 |
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>. |
| 526 |
<p> |
| 527 |
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>. |
| 528 |
<p> |
| 529 |
Referenced by <a class="el" href="dns_8c-source.html#l00217">DNS_query()</a>. </td> |
| 530 |
</tr> |
| 531 |
</table> |
| 532 |
<hr><h2>Variable Documentation</h2> |
| 533 |
<a class="anchor" name="a0" doxytag="dns.c::dns_mutex" ></a><p> |
| 534 |
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> |
| 535 |
<tr> |
| 536 |
<td class="mdRow"> |
| 537 |
<table cellpadding="0" cellspacing="0" border="0"> |
| 538 |
<tr> |
| 539 |
<td class="md" nowrap valign="top"> void* <a class="el" href="dns_8c.html#a0">dns_mutex</a> </td> |
| 540 |
</tr> |
| 541 |
</table> |
| 542 |
</td> |
| 543 |
</tr> |
| 544 |
</table> |
| 545 |
<table cellspacing=5 cellpadding=0 border=0> |
| 546 |
<tr> |
| 547 |
<td> |
| 548 |
|
| 549 |
</td> |
| 550 |
<td> |
| 551 |
|
| 552 |
<p> |
| 553 |
Definition at line <a class="el" href="dns_8c-source.html#l00072">72</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>. </td> |
| 554 |
</tr> |
| 555 |
</table> |
| 556 |
<hr size="1"><address style="align: right;"><small>Generated on Thu Sep 16 18:10:47 2004 for libSPF v1.0 by |
| 557 |
<a href="http://www.doxygen.org/index.html"> |
| 558 |
<img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> |
| 559 |
</body> |
| 560 |
</html> |