1 <!-- Copyright (C) 2003 Red Hat, Inc. -->
2 <!-- This material may be distributed only subject to the terms -->
3 <!-- and conditions set forth in the Open Publication License, v1.0 -->
4 <!-- or later (the latest version is presently available at -->
5 <!-- http://www.opencontent.org/openpub/). -->
6 <!-- Distribution of the work or derivative of the work in any -->
7 <!-- standard (paper) book form is prohibited unless prior -->
8 <!-- permission is obtained from the copyright holder. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="DNS for eCos and RedBoot"
23 HREF="net-ns-dns.html"><LINK
25 TITLE="DNS for eCos and RedBoot"
26 HREF="net-ns-dns.html"><LINK
28 TITLE="Ethernet Device Drivers"
29 HREF="io-eth-drv-generic.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="net-ns-dns.html"
71 HREF="io-eth-drv-generic.html"
84 NAME="NET-NS-DNS-API">Chapter 45. DNS</H1
90 NAME="NET-NS-DNS-API1">DNS API</H1
92 >The DNS client uses the normal BSD API for performing lookups:
102 >There are a few restrictions:</P
108 >Only IPv4 is supported, ie IPv6 addresses cannot be looked
113 >If the DNS server returns multiple authoritive records
114 for a host name, the hostent will only contain a record for the
119 >The code has been made thread safe. ie multiple threads
125 without causing problems to the hostent structure returned. What
126 is not safe is one thread using both
136 A call to one will destroy the results from the previous call
137 to the other function.</P
141 >To initialise the DNS client the following function must be
150 CLASS="PROGRAMLISTING"
151 >#include <network.h>
152 int cyg_dns_res_init(struct in_addr *dns_server)</PRE
157 >where dns_server is the address of the DNS server
158 the client should query. On Error this function returns -1, otherwise
159 0 for success. If lookups are attemped before this function has
160 been called, they will fail and return NULL.</P
162 >A default, hard coded, server may be specified in the CDL option
165 >CYGDAT_NS_DNS_DEFAULT_SERVER</TT
166 >. The use of this is
169 >CYGPKG_NS_DNS_DEFAULT</TT
173 >init_all_network_interfaces</TT
175 initialize the resolver with the hard coded address. The DHCP client
176 or user code my override this address by calling
179 >cyg_dns_res_init</TT
182 >The DNS client understands the concepts of the target being
183 in a domain. By default no domain will be used. Host name lookups
184 should be for fully qualified names. The domain name can be set
185 and retrieved using the functions:
195 >int getdomainname</CODE
196 >(char *name, size_t len);</CODE
202 >int setdomainname</CODE
203 >(const char *name, size_t len);</CODE
210 >Alternatively, a hard coded domain name can be set using CDL.
213 >CYGPKG_NS_DNS_DOMAINNAME</TT
215 and the domain name is taken from
218 >CYGPKG_NS_DNS_DOMAINNAME_NAME</TT
221 >Once set, the DNS client will first perform a lookup with the domain
222 name appended. If this fails it will then perform a second lookup
223 without the appended domain name. </P
231 SUMMARY="Footer navigation table"
242 HREF="net-ns-dns.html"
260 HREF="io-eth-drv-generic.html"
270 >DNS for eCos and RedBoot</TD
276 HREF="net-ns-dns.html"
284 >Ethernet Device Drivers</TD