--- libc.txt 2007-07-04 06:17:20.000000000 -0300 +++ libc_new.txt 2007-07-04 06:16:19.000000000 -0300 @@ -26062,6 +26062,135 @@ - Function: void endhostent (void) This function closes the hosts database. +Domain Name Servers +................... + +It is known as "resolver" as the set of routines in the C library that +provide access to the Internet Domain Name System (DNS). These routines +are used for making, sending, and interpreting query and reply messages +passed to and from Internet domain name servers. The resolver configuration +file (resolv.conf) contains information that is read by the resolver +routines the first time they are invoked by a process. The file is designed +to be human readable and contains a list of keywords with values that +provide various types of resolver information. The resolver functions +are declared in the header files `netinet/in.h', `arpa/nameser.h' and +`resolv.h'. They are: + + - Function: int res_init (void) + This function reads the configuration file (resolv.conf) to get + the default domain name, search order and name server address(es). + If no server is given, the local host is tried. If no domain is + given, that associated with the local host is used. It can be + overridden with the environment variable LOCALDOMAIN. `res_init' + is normally executed by the first call to one of the other functions. + It returns 0 on success and -1 on error. + + - Function: int res_query (const char *DNAME, int CLASS, int TYPE, + unsigned char *ANSWER, int ANSLEN) + This function queries the name server for the fully-qualified + domain name DNAME of specified TYPE and CLASS. The reply is left + in the buffer ANSWER of length ANSLEN supplied by the caller. + It returns the length of the response, or -1 if an error occurs. + + - Function: int res_search (const char *DNAME, int CLASS, int TYPE, + unsigned char *ANSWER, int ANSLEN) + This function makes a query and waits for the response like + `res_query' function, but in addition implements the default and + search rules controlled by RES_DEFNAMES and RES_DNSRCH (see + description of _res options below). `res_search' returns the length + of the response, or -1 if an error occurs. + + The following functions are low-level routines used by `res_query' +function. + + - Function: int res_querydomain (const char *NAME, const char *DOMAIN, + int CLASS, int TYPE, unsigned char *ANSWER, int ANSLEN) + This function makes a query using `res_query' on the concatenation + of NAME and DOMAIN. `res_querydomain' returns the length of the + response, or -1 if an error occurs. + + - Function: int res_mkquery (int OP, const char *DNAME, int CLASS, + int TYPE, char *DATA, int DATALEN, struct rrec *NEWRR, + char *BUF, int BUFLEN) + This function constructs a query message in BUF of length BUFLEN + for the domain name DNAME. The query type OP is usually QUERY, + but can be any of the types defined in `arpa/nameser.h'. NEWRR + is currently unused. `res_mkquery' returns the length of the + response, or -1 if an error occurs. + + - Function: int res_send (const char *MSG, int MSGLEN, char *ANSWER, + int ANSLEN) + This function sends a pre-formatted query given in MSG of length + MSGLEN and returns the answer in ANSWER which is of length ANSLEN. + It will call `res_init' function, if it has not already been called. + `res_send' returns the length of the response, or -1 if an error + occurs. + + - Function: int dn_comp (unsigned char *EXP_DN, unsigned char *COMP_DN, + int LENGTH, unsigned char *DNPTRS, unsigned char *EXP_DN, + unsigned char **LASTDNPTR) + The `dn_comp' function compresses the domain name EXP_DN and stores + it in the buffer COMP_DN of length LENGTH. The compression uses an + array of pointers DNPTRS to previously compressed names in the + current message. The first pointer points to the beginning of the + message and the list ends with NULL. The limit of the array is + specified by LASTDNPTR. If DNPTR is NULL, domain names are not + compressed. If LASTDNPTR is NULL, the list of labels is not updated. + `dn_comp' returns the length of the compressed name, or -1 if an + error occurs. + + - Function: int dn_expand (unsigned char *MSG, unsigned char *EOMORIG, + unsigned char *COMP_DN, unsigned char *EXP_DN, int LENGTH) + This function expands the compressed domain name COMP_DN to a full + domain name, which is placed in the buffer EXP_DN of size LENGTH. + The compressed name is contained in a query or reply message, and + MSG points to the beginning of the message. `dn_expand' returns + the length of the compressed name, or -1 if an error occurs. + + The resolver routines use global configuration and state information +contained in the structure _res, which is defined in `resolv.h'. The only +field that is normally manipulated by the user is _res.options. This field +can contain the bitwise ``or'' of the following options: + +`RES_INIT' + True if `res_init' has been called. + +`RES_DEBUG' + Print debugging messages. + +`RES_AAONLY' + Accept authoritative answers only. `res_send' function continues until + it fins an authoritative answer or returns an error. [Not currently + implemented]. + +`RES_USEVC' + Use TCP connections for queries rather than UDP datagrams. + +`RES_PRIMARY' + Query primary domain name server only. + +`RES_IGNTC' + Ignore truncation errors. Don't retry with TCP. [Not currently + implemented]. + +`RES_RECURSE' + Set the recursion desired bit in queries. Recursion is carried out + by the domain name server, not by `res_send' function. [Enabled by + default]. + +`RES_DEFNAMES' + If set, `res_search' function will append the default domain name + to single component names, ie. those that do not contain a dot. + [Enabled by default]. + +`RES_STAYOPEN' + Used with RES_USEVC to keep the TCP connection open between queries. + +`RES_DNSRCH' + If set, `res_search' function will search for host names in the + current domain and in parent domains. This option is used by + `gethostbyname' function. [Enabled by default]. + Internet Ports --------------