📄 dns_8c.html
字号:
<li> - 1 - error in processing <li> 0 - DNS reply successfully processed </ul></dl><dl compact><dt><b>Note: </b></dt><dd> <ul><li> Event listeners are NOT to be invoked directly. They are callback functions invoked by the TCP/IP stack to notify events.</ul></dl>This, of course, is where responses from DNS server are processed and checked whether they contain the IP address we requested or if they contain authorative name server to which we should proceed.<p>If we received the IP address we requested, <a class="el" href="dns_8h.html#a5">DNS_EVENT_SUCCESS</a> is reported to application DNS event listener. Otherwise <a class="el" href="dns_8h.html#a4">DNS_EVENT_ERROR</a> is reported. <p>Definition at line <a class="el" href="dns_8c-source.html#l00205">205</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>References <a class="el" href="dns_8h-source.html#l00124">DNS_ERROR_GENERAL</a>, <a class="el" href="dns_8h-source.html#l00084">DNS_EVENT_ERROR</a>, <a class="el" href="dns_8h-source.html#l00087">DNS_EVENT_SUCCESS</a>, <a class="el" href="dns_8c-source.html#l00095">dns_hostptr</a>, <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, <a class="el" href="dns_8c-source.html#l00089">dns_socket</a>, <a class="el" href="dns_8c-source.html#l00088">dns_state</a>, <a class="el" href="dns_8c-source.html#l00093">dns_tmp_ip</a>, <a class="el" href="system_8h-source.html#l00210">RECEIVE_NETWORK_B</a>, and <a class="el" href="tcp__ip_8h-source.html#l00276">UDP_EVENT_DATA</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00108">dns_init()</a>. </td> </tr></table><a name="a14" doxytag="dns.c::get_host_by_name"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8 get_host_by_name </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">UINT8 * </td> <td class="mdname" nowrap> <em>host_name_ptr</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>void(* </td> <td class="mdname" nowrap> <em>listener</em>)(UINT8, UINT32)</td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p><dl compact><dt><b>Author: </b></dt><dd> <ul><li> Vladan Jovanovic (<a href="mailto:vladan.jovanovic@violasystems.com">vladan.jovanovic@violasystems.com</a>) </ul></dl><dl compact><dt><b>Date: </b></dt><dd>10.10.2002 </dl><dl compact><dt><b>Parameters: </b></dt><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>host_name_ptr</em> </td><td>Pointer to null-terminated host name to be resolved </td></tr><tr><td valign=top><em>listener</em> </td><td>Pointer to DNS listener function that listens to events from DNS client. This function takes two parameters: first one can take a value of <a class="el" href="dns_8h.html#a5">DNS_EVENT_SUCCESS</a> or <a class="el" href="dns_8h.html#a4">DNS_EVENT_ERROR</a> and thus determine the meaning of the second parameter. If first parameter is <a class="el" href="dns_8h.html#a5">DNS_EVENT_SUCCESS</a>, second parameter represents requested IP address. In case of <a class="el" href="dns_8h.html#a4">DNS_EVENT_ERROR</a>, second parameter can be one of the: <a class="el" href="dns_8h.html#a6">DNS_ERROR_FORMAT</a>, <a class="el" href="dns_8h.html#a7">DNS_ERROR_SERVER_FAILURE</a>, <a class="el" href="dns_8h.html#a8">DNS_ERROR_NAME_ERROR</a>, <a class="el" href="dns_8h.html#a9">DNS_ERROR_NOT_IMPLEMENTED</a>, <a class="el" href="dns_8h.html#a10">DNS_ERROR_REFUSED</a>, <a class="el" href="dns_8h.html#a11">DNS_ERROR_TIMEOUT</a>, <a class="el" href="dns_8h.html#a12">DNS_ERROR_GENERAL</a> </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><li> <a class="el" href="dns_8h.html#a13">DNS_ERROR_BUSY</a> - Signals that DNS is currently processing another request so it is not possible to process a new one <li> <a class="el" href="dns_8h.html#a16">DNS_ERROR_OVERFLOW</a> - Network transmit buffer too small to hold DNS request <li> <a class="el" href="dns_8h.html#a14">DNS_ERROR_LABEL</a> - Label in host name longer than 63 bytes. Error <li> <a class="el" href="dns_8h.html#a15">DNS_ERROR_NAME</a> - Host name longer than 264 bytes. Error</ul></dl>Invoke this function to start name-resolving process. Note that currently DNS client can process only one request at a time and will not allow multiple requests. <p>Definition at line <a class="el" href="dns_8c-source.html#l00445">445</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>References <a class="el" href="dns_8h-source.html#l00135">DNS_ERROR_BUSY</a>, <a class="el" href="dns_8c-source.html#l00095">dns_hostptr</a>, <a class="el" href="dns_8h-source.html#l00078">DNS_NUM_RETRIES</a>, <a class="el" href="dns_8h-source.html#l00075">DNS_RESEND_PERIOD</a>, <a class="el" href="dns_8c-source.html#l00091">dns_retries</a>, <a class="el" href="dns_8h-source.html#l00073">DNS_SERVER_IP</a>, <a class="el" href="dns_8c-source.html#l00089">dns_socket</a>, <a class="el" href="dns_8c-source.html#l00088">dns_state</a>, <a class="el" href="dns_8c-source.html#l00090">dns_timer</a>, <a class="el" href="dns_8c-source.html#l00093">dns_tmp_ip</a>, <a class="el" href="dns_8h-source.html#l00069">DNS_UDP_PORT</a>, <a class="el" href="timers_8c-source.html#l00194">init_timer()</a>, <a class="el" href="system_8h-source.html#l00091">NETWORK_TX_BUFFER_SIZE</a>, <a class="el" href="system_8h-source.html#l00163">RESET_SYSTEM</a>, <a class="el" href="timers_8h-source.html#l00086">TIMERTIC</a>, <a class="el" href="tcp__ip_8h-source.html#l00471">UDP_APP_OFFSET</a>, and <a class="el" href="udp_8c-source.html#l00395">udp_send()</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>. </td> </tr></table><hr><h2>Variable Documentation</h2><a name="a3" doxytag="dns.c::dns_state"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8 dns_state </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Current DNS state. Used to prevent multiple requests, issue retransmissions,... See DNS_STATE_* for possible values. <p>Definition at line <a class="el" href="dns_8c-source.html#l00088">88</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00205">dns_eventlistener()</a>, <a class="el" href="dns_8c-source.html#l00108">dns_init()</a>, <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, <a class="el" href="dns_8c-source.html#l00168">dns_run()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><a name="a4" doxytag="dns.c::dns_socket"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8 dns_socket </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>UDP socket used by the DNS resolver <p>Definition at line <a class="el" href="dns_8c-source.html#l00089">89</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00205">dns_eventlistener()</a>, <a class="el" href="dns_8c-source.html#l00108">dns_init()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><a name="a5" doxytag="dns.c::dns_timer"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8 dns_timer </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>DNS timer handle used for retransmissions <p>Definition at line <a class="el" href="dns_8c-source.html#l00090">90</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00108">dns_init()</a>, <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, <a class="el" href="dns_8c-source.html#l00168">dns_run()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><a name="a6" doxytag="dns.c::dns_retries"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8 dns_retries </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>DNS retry counter used for detecting timeouts <p>Definition at line <a class="el" href="dns_8c-source.html#l00091">91</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><a name="a7" doxytag="dns.c::dns_tmp_ip"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT32 dns_tmp_ip </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Used in many ways: as an IP address holder, for issuing requests to authorative name servers,.. <p>Definition at line <a class="el" href="dns_8c-source.html#l00093">93</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00205">dns_eventlistener()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><a name="a8" doxytag="dns.c::dns_hostptr"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> UINT8* dns_hostptr </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Pointer to hostname that is beeing resolved. Needed for retransmissions. <p>Definition at line <a class="el" href="dns_8c-source.html#l00095">95</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>Referenced by <a class="el" href="dns_8c-source.html#l00205">dns_eventlistener()</a>, <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, and <a class="el" href="dns_8c-source.html#l00445">get_host_by_name()</a>. </td> </tr></table><hr><address style="align: right;"><small>Generated on Sun Aug 3 20:33:00 2003 for OpenTCP by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -