Next: , Previous: , Up: Networking Support   [Contents][Index]


10.2 Domain Name Services (DNS)

The networking support of CMUCL includes the possibility of doing DNS lookups. The function

Function: extensions:lookup-host-entry host

returns a structure of type host-entry (see host-entry-struct) for the given host. If host is an integer, it will be assumed to be the IP address in host (byte-)order. If it is a string, it can contain either the host name or the IP address in dotted format.

This function works by completing the structure host-entry. That is, if the user provides the IP address, then the structure will contain that information and also the domain names. If the user provides the domain name, the structure will be complemented with the IP addresses along with the any aliases the host might have.

structure: host-entry name aliases addr-type addr-list

This structure holds all information available at request time on a given host. The entries are self-explanatory. Aliases is a list of strings containing alternative names of the host, and addr-list a list of addresses stored in host byte order. The field addr-type contains the number of the address family, as specified in socket.h, to which the addresses belong. Since only addresses of the IPv4 family are currently supported, this slot always has the value 2.

Function: extensions:ip-string addr

This function takes an IP address in host order and returns a string containing it in dotted format.