This libarary contains functions for resolving a host name to an IP address that is usable by the silicon software for making socket function calls. Note that the functions in this library are not safe to be called from multiple processes at the same time. The functions in this library store their results in static memory locations, and must be retrieved and stored in alternate locations before further DNS operations are performed.
Note that as of version 3, this library has been changed to use the system-wide DNS server entries, which might be set by the DHCP client (from data recieved in a DHCP response). Applications can make sure they have a valid server entry by making sure the DNS server IP addresses are not all 0's, since the ROM initialization functions clear the DNS server entries.
For detailed information on the DS80C400 please see the High-Speed Microcontroller User's Guide: DS80C400 Supplement.
The functions in this library use String functions such as sprintf for data formatting, which are not multiprocess safe. Care must be taken that DNS functions do not operate at the same time as other string formatting operations.
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
| struct | hostent |
| struct | mailhostent |
Defines | |
| #define | TINI400_DNS_VERSION 7 |
Functions | |
| hostent * | gethostbyaddr (void *addr, size_t len, int type) |
| Looks up information on a host given an IP address. | |
| hostent * | gethostbyname (char *name) |
| Looks up information on a host given a host name. | |
| void | dns_init (void) |
| Initializes the DNS client code. | |
| void | dns_settimeout (unsigned long t) |
| Sets the socket timeout value used for DNS server communications. | |
| void | dns_setmaxtimeout (unsigned long t) |
| Sets the maximum socket timeout value used for DNS server communications. | |
| unsigned long | dns_gettimeout (void) |
| Gets the socket timeout value used for DNS server communications. | |
| void | dns_getprimary (struct sockaddr *sa) |
| Gets the address of the primary DNS server. | |
| void | dns_setprimary (struct sockaddr *sa) |
| Sets the address of the primary DNS server. | |
| void | dns_getsecondary (struct sockaddr *sa) |
| Gets the address of the secondary DNS server. | |
| void | dns_setsecondary (struct sockaddr *sa) |
| Sets the address of the secondary DNS server. | |
| mailhostent * | dns_getmx (char *name) |
| Performs a DNS MX record lookup. | |
| void | dns_enableipv6queries (unsigned char enable) |
| Enables/disables attempts to make IPv6 DNS queries. | |
| unsigned int | dns_version () |
| Returns the version number of this DNS client library. | |
|
|
Version number associated with this header file. Should be the same as the version number returned by the dns_version function.
|
|
|
Enables/disables attempts to make IPv6 DNS queries. Use an enable value of 0 to disable attempts to perform IPv6 queries. Diabling IPv6 queries can dramatically increase the speed of the library routines. Use an enable value of non-zero to enable IPv6 DNS queries.
|
|
|
Performs a DNS MX record lookup. MX records are mail exchanger records. In order to send an email without using a mail relay (mail host), you need to look up the MX record of the remote domain and then open the SMTP connection to the address returned by dns_getmx().
|
|
|
Gets the address of the primary DNS server. Fills in an address structure with the IP of the secondary DNS server used by this DNS client code. DNS operations first try to use a server designated as primary, and the use a server designated as secondary if the primary fails to return results. Note that this gets the system's primary DNS server setting. This may have been set by the DHCP client or by previous calls to dns_setprimary. This function is equivalent to dhcp_getprimarydns.
|
|
|
Gets the address of the secondary DNS server. Fills in an address structure with the IP of the secondary DNS server used by this DNS client code. DNS operations first try to use a server designated as primary, and the use a server designated as secondary if the primary fails to return results. Note that this gets the system's secondary DNS server setting. This may have been set by the DHCP client or by previous calls to dns_setsecondary. This function is equivalent to dhcp_getsecondarydns.
|
|
|
Gets the socket timeout value used for DNS server communications. Gets the timeout value applied to all sockets that communicate with the DNS server. Call this function to verify the timeout used by DNS socket operations.
|
|
|
Initializes the DNS client code. Performs initialization for the DNS client. This function need only be called once at the start of the application. |
|
|
Sets the maximum socket timeout value used for DNS server communications. Sets the maximum timeout value that can be applied sockets that communicate with the DNS server. DNS operations are retried up to 4 times, and each time the timeout is doubled. This function sets the maximum timeout allowed for a single operation.
|
|
|
Sets the address of the primary DNS server. Sets the address of the primary DNS server used by this DNS client code. DNS operations first try to use a server designated as primary, and the use a server designated as secondary if the primary fails to return results. Note that this sets the system's primary DNS server setting. If the system's primary DNS server entry had been previously set by the DHCP client, that information will be destroyed by this function.
|
|
|
Sets the address of the secondary DNS server. Sets the address of the secondary DNS server used by this DNS client code. DNS operations first try to use a server designated as primary, and the use a server designated as secondary if the primary fails to return results. Note that this sets the system's secondary DNS server setting. If the system's secondary DNS server entry had been previously set by the DHCP client, that information will be destroyed by this function.
|
|
|
Sets the socket timeout value used for DNS server communications. Sets the timeout value applied to all sockets that communicate with the DNS server. Call this function to make sure DNS operations fail after a reasonable waiting time. All DNS operations are retried up to 4 times. In each retry, the local timeout will be doubled, up to the maximum timeout allowed.
|
|
|
Returns the version number of this DNS client library.
|
|
||||||||||||||||
|
Looks up information on a host given an IP address. Contacts a DNS server and attempts to find known host names for the given IP address.
|
|
|
Looks up information on a host given a host name. Contacts a DNS server and attempts to find known IP addresses given a host name.
|
| Copyright 2005 Dallas Semiconductor, Inc.. | Documentation generated by Doxygen. |