📄 dns_8c.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>dns.c File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="modules.html">Modules</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> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center><hr><h1>/opentcp/dns/dns.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2> <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>Version: </b></dt><dd>1.0 </dl><dl compact><dt><b>Date: </b></dt><dd>10.10.2002 </dl><dl compact><dt><b><a class="el" href="bug.html#_bug000010">Bug: </a></b></dt><dd></dl> <dl compact><dt><b>Warning: </b></dt><dd> </dl><dl compact><dt><b><a class="el" href="todo.html#_todo000010">Todo: </a></b></dt><dd><ul><li> Probably should implement sending different ID with requests. <li> Maybe create similar cache as for ARP ? <li> <b>Definitely</b> implement DNS's IP address use as a parameter to get_host_by_name function. This would allow more flexible manipulation</dl></ul>OpenTCP DNS client implementation. API functions, data structures and constants may be found in <a class="el" href="dns_8h.html">inet/dns/dns.h</a><p><p>Definition in file <a class="el" href="dns_8c-source.html">dns.c</a>.<p><a href="dns_8c-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td></td></tr><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="dns_8c.html#a10">dns_init</a> (void)</td></tr><tr><td> </td><td><font size=-1><em>Initialize resources needed for the DNS client.</em> <a href="#a10"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="dns_8c.html#a11">dns_retransmit</a> (void)</td></tr><tr><td> </td><td><font size=-1><em>Retransmits requests towards the DNS server.</em> <a href="#a11"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="dns_8c.html#a12">dns_run</a> (void)</td></tr><tr><td> </td><td><font size=-1><em>DNS client main loop.</em> <a href="#a12"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>INT32 </td><td valign=bottom><a class="el" href="dns_8c.html#a13">dns_eventlistener</a> (INT8 cbhandle, UINT8 event, UINT32 ipaddr, UINT16 port, UINT16 buffindex, UINT16 datalen)</td></tr><tr><td> </td><td><font size=-1><em>DNS client event listener.</em> <a href="#a13"></a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="dns_8c.html#a14">get_host_by_name</a> (UINT8 *host_name_ptr, void(*listener)(UINT8, UINT32))</td></tr><tr><td> </td><td><font size=-1><em>Invokes DNS resolver.</em> <a href="#a14"></a><em></em></font><br><br></td></tr><tr><td colspan=2><br><h2>Variables</h2></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="dns_8c.html#a3">dns_state</a></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="dns_8c.html#a4">dns_socket</a></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="dns_8c.html#a5">dns_timer</a></td></tr><tr><td nowrap align=right valign=top>UINT8 </td><td valign=bottom><a class="el" href="dns_8c.html#a6">dns_retries</a></td></tr><tr><td nowrap align=right valign=top>UINT32 </td><td valign=bottom><a class="el" href="dns_8c.html#a7">dns_tmp_ip</a></td></tr><tr><td nowrap align=right valign=top>UINT8 * </td><td valign=bottom><a class="el" href="dns_8c.html#a8">dns_hostptr</a></td></tr></table><hr><h2>Function Documentation</h2><a name="a10" doxytag="dns.c::dns_init"></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"> void dns_init </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></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>Invoke this function at startup to properly initialize DNS resources. <p>Definition at line <a class="el" href="dns_8c-source.html#l00108">108</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>References <a class="el" href="dns_8c-source.html#l00205">dns_eventlistener()</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_8h-source.html#l00069">DNS_UDP_PORT</a>, <a class="el" href="timers_8c-source.html#l00131">get_timer()</a>, <a class="el" href="udp_8c-source.html#l00175">udp_getsocket()</a>, <a class="el" href="udp_8c-source.html#l00291">udp_open()</a>, <a class="el" href="tcp__ip_8h-source.html#l00140">UDP_OPT_CHECK_CS</a>, and <a class="el" href="tcp__ip_8h-source.html#l00132">UDP_OPT_SEND_CS</a>. </td> </tr></table><a name="a11" doxytag="dns.c::dns_retransmit"></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"> void dns_retransmit </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></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>This is internal function and IS NOT INTENDED to be invoked by the user application. It simply checks if retransmissions should be done (when retransmissions not used yet) and if yes, sends one. Otherwise timeout error is sent to the event listener. <p>Definition at line <a class="el" href="dns_8c-source.html#l00142">142</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>References <a class="el" href="dns_8h-source.html#l00119">DNS_ERROR_TIMEOUT</a>, <a class="el" href="dns_8h-source.html#l00084">DNS_EVENT_ERROR</a>, <a class="el" href="dns_8c-source.html#l00095">dns_hostptr</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_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#l00445">get_host_by_name()</a>, <a class="el" href="timers_8c-source.html#l00194">init_timer()</a>, and <a class="el" href="timers_8h-source.html#l00086">TIMERTIC</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#l00168">dns_run()</a>. </td> </tr></table><a name="a12" doxytag="dns.c::dns_run"></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"> void dns_run </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></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>Simple main loop that checks whether DNS requests should be sent or not (based on timer timeout). If yes, and DNS is in appropriate state, <a class="el" href="dns_8c.html#a11">dns_retransmit()</a> function is invoked. <p>Definition at line <a class="el" href="dns_8c-source.html#l00168">168</a> of file <a class="el" href="dns_8c-source.html">dns.c</a>.<p>References <a class="el" href="timers_8c-source.html#l00233">check_timer()</a>, <a class="el" href="dns_8c-source.html#l00142">dns_retransmit()</a>, <a class="el" href="dns_8c-source.html#l00088">dns_state</a>, and <a class="el" href="dns_8c-source.html#l00090">dns_timer</a>. </td> </tr></table><a name="a13" doxytag="dns.c::dns_eventlistener"></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"> INT32 dns_eventlistener </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">INT8 </td> <td class="mdname" nowrap> <em>cbhandle</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT8 </td> <td class="mdname" nowrap> <em>event</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT32 </td> <td class="mdname" nowrap> <em>ipaddr</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>port</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>buffindex</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>UINT16 </td> <td class="mdname" nowrap> <em>datalen</em></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>cbhandle</em> </td><td>handle of the socket this packet is intended for. </td></tr><tr><td valign=top><em>event</em> </td><td>event that is notified. For UDP, only UDP_EVENT_DATA. </td></tr><tr><td valign=top><em>ipaddr</em> </td><td>IP address of remote host who sent the UDP datagram </td></tr><tr><td valign=top><em>port</em> </td><td>port number of remote host who sent the UDP datagram </td></tr><tr><td valign=top><em>buffindex</em> </td><td>buffer index in RTL8019AS </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -