OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [ns/] [dns/] [v2_0/] [doc/] [dns.sgml] - Diff between revs 27 and 174

Only display areas with differences | Details | Blame | View Log

Rev 27 Rev 174
DNS for eCos and RedBoot
DNS for eCos and RedBoot
eCos and
eCos and
RedBoot
RedBoot
can both use the DNS package to perform network name lookups.
can both use the DNS package to perform network name lookups.
DNS
DNS
DNS API
DNS API
The DNS client uses the normal BSD API for performing lookups:
The DNS client uses the normal BSD API for performing lookups:
gethostbyname() and
gethostbyname() and
gethostbyaddr().
gethostbyaddr().
There are a few restrictions:
There are a few restrictions:
Only IPv4 is supported, ie IPv6 addresses cannot be looked
Only IPv4 is supported, ie IPv6 addresses cannot be looked
up.
up.
If the DNS server returns multiple authoritive records
If the DNS server returns multiple authoritive records
for a host name, the hostent will only contain a record for the
for a host name, the hostent will only contain a record for the
first entry.
first entry.
The code has been made thread safe. ie multiple threads
The code has been made thread safe. ie multiple threads
may call
may call
gethostbyname()
gethostbyname()
 without causing problems to the hostent structure returned. What
 without causing problems to the hostent structure returned. What
is not safe is one thread using both
is not safe is one thread using both
gethostbyname()
gethostbyname()
 and
 and
gethostbyaddr().
gethostbyaddr().
A call to one will destroy the results from the previous call
A call to one will destroy the results from the previous call
to the other function.
to the other function.
To initialise the DNS client the following function must be
To initialise the DNS client the following function must be
called:
called:
#include <network.h>
#include <network.h>
int cyg_dns_res_init(struct in_addr *dns_server)
int cyg_dns_res_init(struct in_addr *dns_server)
where dns_server is the address of the DNS server
where dns_server is the address of the DNS server
the client should query. On Error this function returns -1, otherwise
the client should query. On Error this function returns -1, otherwise
0 for success. If lookups are attemped before this function has
0 for success. If lookups are attemped before this function has
been called, they will fail and return NULL.
been called, they will fail and return NULL.
A default, hard coded, server may be specified in the CDL option
A default, hard coded, server may be specified in the CDL option
CYGDAT_NS_DNS_DEFAULT_SERVER. The use of this is
CYGDAT_NS_DNS_DEFAULT_SERVER. The use of this is
controlled by CYGPKG_NS_DNS_DEFAULT. If this is
controlled by CYGPKG_NS_DNS_DEFAULT. If this is
enabled, init_all_network_interfaces will
enabled, init_all_network_interfaces will
initialize the resolver with the hard coded address. The DHCP client
initialize the resolver with the hard coded address. The DHCP client
or user code my override this address by calling
or user code my override this address by calling
cyg_dns_res_init again. 
cyg_dns_res_init again. 
The DNS client understands the concepts of the target being
The DNS client understands the concepts of the target being
in a domain. By default no domain will be used. Host name lookups
in a domain. By default no domain will be used. Host name lookups
should be for fully qualified names. The domain name can be set
should be for fully qualified names. The domain name can be set
and retrieved using the functions:
and retrieved using the functions:
  
  
    int getdomainname
    int getdomainname
    char *name
    char *name
    size_t len
    size_t len
  
  
  
  
    int setdomainname
    int setdomainname
    const char *name
    const char *name
    size_t len
    size_t len
  
  
Alternatively, a hard coded domain name can be set using CDL.
Alternatively, a hard coded domain name can be set using CDL.
The boolean CYGPKG_NS_DNS_DOMAINNAME enables this
The boolean CYGPKG_NS_DNS_DOMAINNAME enables this
and the domain name is taken from
and the domain name is taken from
CYGPKG_NS_DNS_DOMAINNAME_NAME.
CYGPKG_NS_DNS_DOMAINNAME_NAME.
Once set, the DNS client will first perform a lookup with the domain
Once set, the DNS client will first perform a lookup with the domain
name appended. If this fails it will then perform a second lookup
name appended. If this fails it will then perform a second lookup
without the appended domain name. 
without the appended domain name. 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.