⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dns_8h.html

📁 Freescale mcu OpenTCP-1.0.4.doc.html.zip 文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:
Definition at line <a class="el" href="dns_8h-source.html#l00147">147</a> of file <a class="el" href="dns_8h-source.html">dns.h</a>.    </td>  </tr></table><hr><h2>Function Documentation</h2><a name="a17" doxytag="dns.h::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">(&nbsp;</td>          <td class="md" nowrap valign="top">UINT8 *&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>host_name_ptr</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>void(*&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>listener</em>)(UINT8, UINT32)</td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>&nbsp;</td><td>Pointer to null-terminated host name to be resolved </td></tr><tr><td valign=top><em>listener</em>&nbsp;</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><a name="a18" doxytag="dns.h::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">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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="a19" doxytag="dns.h::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">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>&nbsp;          </td>          <td class="md" valign="top">)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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="a20" doxytag="dns.h::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">(&nbsp;</td>          <td class="md" nowrap valign="top">INT8&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>cbhandle</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT8&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>event</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT32&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>ipaddr</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>port</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>buffindex</em>, </td>        </tr>        <tr>          <td></td>          <td></td>          <td class="md" nowrap>UINT16&nbsp;</td>          <td class="mdname" nowrap>&nbsp; <em>datalen</em></td>        </tr>        <tr>          <td></td>          <td class="md">)&nbsp;</td>          <td class="md" colspan="2"></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </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>&nbsp;</td><td>handle of the socket this packet is intended for. </td></tr><tr><td valign=top><em>event</em>&nbsp;</td><td>event that is notified. For UDP, only UDP_EVENT_DATA. </td></tr><tr><td valign=top><em>ipaddr</em>&nbsp;</td><td>IP address of remote host who sent the UDP datagram </td></tr><tr><td valign=top><em>port</em>&nbsp;</td><td>port number of remote host who sent the UDP datagram </td></tr><tr><td valign=top><em>buffindex</em>&nbsp;</td><td>buffer index in RTL8019AS </td></tr></table></dl><dl compact><dt><b>Returns: </b></dt><dd> <ul><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><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 + -