285 lines
16 KiB
HTML
285 lines
16 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
<title>uIP 1.0: DNS resolver</title>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
|
<link href="tabs.css" rel="stylesheet" type="text/css">
|
|
</head><body>
|
|
<!-- Generated by Doxygen 1.4.6 -->
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="main.html"><span>Main Page</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="classes.html"><span>Data Structures</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li><a href="examples.html"><span>Examples</span></a></li>
|
|
</ul></div>
|
|
<h1>DNS resolver<br>
|
|
<small>
|
|
[<a class="el" href="a00143.html">Applications</a>]</small>
|
|
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
The uIP DNS resolver functions are used to lookup a hostname and map it to a numerical IP address.
|
|
<p>
|
|
It maintains a list of resolved hostnames that can be queried with the <a class="el" href="a00160.html#g66d19181ad5fe8b8f7c84d1f1d46a2ec">resolv_lookup()</a> function. New hostnames can be resolved using the <a class="el" href="a00160.html#ge4dcbbe6c641d2e3b8537b479df5fc99">resolv_query()</a> function.<p>
|
|
When a hostname has been resolved (or found to be non-existant), the resolver code calls a callback function called <a class="el" href="a00160.html#g6d9751d534453425c7a5a215d1d4414c">resolv_found()</a> that must be implemented by the module that uses the resolver.
|
|
<p>
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></td></tr>
|
|
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="a00103.html">resolv.h</a></td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">DNS resolver code header file. <br></td></tr>
|
|
|
|
<p>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">file </td><td class="memItemRight" valign="bottom"><a class="el" href="a00102.html">resolv.c</a></td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">DNS host name to IP address resolver. <br></td></tr>
|
|
|
|
<p>
|
|
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3d768e989e308144190ae1a5ddfa9726"></a><!-- doxytag: member="resolv::UIP_UDP_APPCALL" ref="g3d768e989e308144190ae1a5ddfa9726" args="" -->
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g3d768e989e308144190ae1a5ddfa9726">UIP_UDP_APPCALL</a> resolv_appcall</td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g070d2ce7b6bb7e5c05602aa8c308d0c4"></a><!-- doxytag: member="resolv::NULL" ref="g070d2ce7b6bb7e5c05602aa8c308d0c4" args="" -->
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> (void *)0</td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gecf13b8dc783db2202ca5c34fe117fc3"></a><!-- doxytag: member="resolv::MAX_RETRIES" ref="gecf13b8dc783db2202ca5c34fe117fc3" args="" -->
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#gecf13b8dc783db2202ca5c34fe117fc3">MAX_RETRIES</a> 8</td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g221d37ccde7e3fd0dd2c2eb0a6b15493"></a><!-- doxytag: member="resolv::RESOLV_ENTRIES" ref="g221d37ccde7e3fd0dd2c2eb0a6b15493" args="" -->
|
|
#define </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g221d37ccde7e3fd0dd2c2eb0a6b15493">RESOLV_ENTRIES</a> 4</td></tr>
|
|
|
|
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g7c5359305008e9183b18d6ab75f568bf"></a><!-- doxytag: member="resolv::resolv_appcall" ref="g7c5359305008e9183b18d6ab75f568bf" args="(void)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g7c5359305008e9183b18d6ab75f568bf">resolv_appcall</a> (void)</td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g6d9751d534453425c7a5a215d1d4414c">resolv_found</a> (char *name, <a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> *ipaddr)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Callback function which is called when a hostname is found. <a href="#g6d9751d534453425c7a5a215d1d4414c"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#gdf916e0c752f5cda70d0bddb2be422ba">resolv_conf</a> (<a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> *dnsserver)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Configure which DNS server to use for queries. <a href="#gdf916e0c752f5cda70d0bddb2be422ba"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g3191066cf8f76bd00b6843b77c37068f">resolv_getserver</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Obtain the currently configured DNS server. <a href="#g3191066cf8f76bd00b6843b77c37068f"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gb50f78bbf36d912d69f6c1685d0b40e3"></a><!-- doxytag: member="resolv::resolv_init" ref="gb50f78bbf36d912d69f6c1685d0b40e3" args="(void)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#gb50f78bbf36d912d69f6c1685d0b40e3">resolv_init</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initalize the resolver. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#g66d19181ad5fe8b8f7c84d1f1d46a2ec">resolv_lookup</a> (char *name)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Look up a hostname in the array of known hostnames. <a href="#g66d19181ad5fe8b8f7c84d1f1d46a2ec"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="a00160.html#ge4dcbbe6c641d2e3b8537b479df5fc99">resolv_query</a> (char *name)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Queues a name so that a question for the name will be sent out. <a href="#ge4dcbbe6c641d2e3b8537b479df5fc99"></a><br></td></tr>
|
|
</table>
|
|
<hr><h2>Function Documentation</h2>
|
|
<a class="anchor" name="gdf916e0c752f5cda70d0bddb2be422ba"></a><!-- doxytag: member="resolv.h::resolv_conf" ref="gdf916e0c752f5cda70d0bddb2be422ba" args="(u16_t *dnsserver)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void resolv_conf </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>dnsserver</em> </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>
|
|
Configure which DNS server to use for queries.
|
|
<p>
|
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>dnsserver</em> </td><td>A pointer to a 4-byte representation of the IP address of the DNS server to be configured. </td></tr>
|
|
</table>
|
|
</dl>
|
|
<dl compact><dt><b>Examples: </b></dt><dd>
|
|
<a class="el" href="a00046.html#a151">resolv.c</a>, and <a class="el" href="a00047.html#a158">resolv.h</a>.</dl>
|
|
<p>
|
|
Definition at line <a class="el" href="a00172.html#l00438">438</a> of file <a class="el" href="a00172.html">resolv.c</a>.
|
|
<p>
|
|
References <a class="el" href="a00202.html#l01070">HTONS</a>, <a class="el" href="a00172.html#l00069">NULL</a>, <a class="el" href="a00201.html#l00473">uip_udp_new()</a>, and <a class="el" href="a00202.html#l00775">uip_udp_remove</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="g6d9751d534453425c7a5a215d1d4414c"></a><!-- doxytag: member="resolv.h::resolv_found" ref="g6d9751d534453425c7a5a215d1d4414c" args="(char *name, u16_t *ipaddr)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void resolv_found </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">char * </td>
|
|
<td class="mdname" nowrap> <em>name</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * </td>
|
|
<td class="mdname" nowrap> <em>ipaddr</em></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md"></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>
|
|
Callback function which is called when a hostname is found.
|
|
<p>
|
|
This function must be implemented by the module that uses the DNS resolver. It is called when a hostname is found, or when a hostname was not found.<p>
|
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>A pointer to the name that was looked up.</td></tr>
|
|
<tr><td valign="top"></td><td valign="top"><em>ipaddr</em> </td><td>A pointer to a 4-byte array containing the IP address of the hostname, or NULL if the hostname could not be found. </td></tr>
|
|
</table>
|
|
</dl>
|
|
<dl compact><dt><b>Examples: </b></dt><dd>
|
|
<a class="el" href="a00046.html#a135">resolv.c</a>, and <a class="el" href="a00047.html#a156">resolv.h</a>.</dl> </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="g3191066cf8f76bd00b6843b77c37068f"></a><!-- doxytag: member="resolv.h::resolv_getserver" ref="g3191066cf8f76bd00b6843b77c37068f" args="(void)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * resolv_getserver </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>
|
|
Obtain the currently configured DNS server.
|
|
<p>
|
|
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to a 4-byte representation of the IP address of the currently configured DNS server or NULL if no DNS server has been configured. </dd></dl>
|
|
<dl compact><dt><b>Examples: </b></dt><dd>
|
|
<a class="el" href="a00046.html#a149">resolv.c</a>, and <a class="el" href="a00047.html#a159">resolv.h</a>.</dl>
|
|
<p>
|
|
Definition at line <a class="el" href="a00172.html#l00422">422</a> of file <a class="el" href="a00172.html">resolv.c</a>.
|
|
<p>
|
|
References <a class="el" href="a00172.html#l00069">NULL</a>, and <a class="el" href="a00202.html#l01211">uip_udp_conn::ripaddr</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="g66d19181ad5fe8b8f7c84d1f1d46a2ec"></a><!-- doxytag: member="resolv.h::resolv_lookup" ref="g66d19181ad5fe8b8f7c84d1f1d46a2ec" args="(char *name)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top"><a class="el" href="a00153.html#g77570ac4fcab86864fa1916e55676da2">u16_t</a> * resolv_lookup </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">char * </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>name</em> </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>
|
|
Look up a hostname in the array of known hostnames.
|
|
<p>
|
|
<dl compact><dt><b>Note:</b></dt><dd>This function only looks in the internal array of known hostnames, it does not send out a query for the hostname if none was found. The function <a class="el" href="a00160.html#ge4dcbbe6c641d2e3b8537b479df5fc99">resolv_query()</a> can be used to send a query for a hostname.</dd></dl>
|
|
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to a 4-byte representation of the hostname's IP address, or NULL if the hostname was not found in the array of hostnames. </dd></dl>
|
|
<dl compact><dt><b>Examples: </b></dt><dd>
|
|
<a class="el" href="a00046.html#a148">resolv.c</a>, <a class="el" href="a00047.html#a161">resolv.h</a>, and <a class="el" href="a00040.html#a271">webclient.c</a>.</dl>
|
|
<p>
|
|
Definition at line <a class="el" href="a00172.html#l00396">396</a> of file <a class="el" href="a00172.html">resolv.c</a>.
|
|
<p>
|
|
References <a class="el" href="a00172.html#l00123">RESOLV_ENTRIES</a>, and <a class="el" href="a00172.html#l00111">STATE_DONE</a>.
|
|
<p>
|
|
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>, and <a class="el" href="a00180.html#l00140">webclient_get()</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="ge4dcbbe6c641d2e3b8537b479df5fc99"></a><!-- doxytag: member="resolv.h::resolv_query" ref="ge4dcbbe6c641d2e3b8537b479df5fc99" args="(char *name)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void resolv_query </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">char * </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>name</em> </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>
|
|
Queues a name so that a question for the name will be sent out.
|
|
<p>
|
|
<dl compact><dt><b>Parameters:</b></dt><dd>
|
|
<table border="0" cellspacing="2" cellpadding="0">
|
|
<tr><td valign="top"></td><td valign="top"><em>name</em> </td><td>The hostname that is to be queried. </td></tr>
|
|
</table>
|
|
</dl>
|
|
<dl compact><dt><b>Examples: </b></dt><dd>
|
|
<a class="el" href="a00046.html#a146">resolv.c</a>, <a class="el" href="a00047.html#a162">resolv.h</a>, and <a class="el" href="a00040.html#a306">webclient.c</a>.</dl>
|
|
<p>
|
|
Definition at line <a class="el" href="a00172.html#l00350">350</a> of file <a class="el" href="a00172.html">resolv.c</a>.
|
|
<p>
|
|
References <a class="el" href="a00172.html#l00123">RESOLV_ENTRIES</a>, and <a class="el" href="a00172.html#l00108">STATE_UNUSED</a>.
|
|
<p>
|
|
Referenced by <a class="el" href="a00180.html#l00378">webclient_appcall()</a>. </td>
|
|
</tr>
|
|
</table>
|
|
<hr size="1"><address style="align: right;"><small>Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
|
|
</body>
|
|
</html>
|