Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
resolver(3)
Edit
PageHistory
Diff
Info
LikePages
RESOLVER !!!RESOLVER NAME SYNOPSIS DESCRIPTION RETURN VALUE FILES CONFORMING TO SEE ALSO ---- !!NAME res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, dn_comp, dn_expand - resolver routines !!SYNOPSIS __#include __''dname''__, int__ ''class''__, int__ ''type''__, unsigned char *__''answer''__, int__ ''anslen''__); int res_search(const char *__''dname''__, int__ ''class''__, int__ ''type''__, unsigned char *__''answer''__, int__ ''anslen''__); int res_querydomain(const char *__''name''__, const char *__''domain''__, int__ ''class''__, int__ ''type''__, unsigned char *__''answer''__, int__ ''anslen''__); int res_mkquery(int__ ''op''__, const char *__''dname''__, int__ ''class''__, int__ ''type''__, char *__''data''__, int__ ''datalen''__, struct rrec *__''newrr''__, char *__''buf''__, int__ ''buflen''__); int res_send(const char *__''msg''__, int__ ''msglen''__, char *__''answer''__, int__ ''anslen''__); int dn_comp(unsigned char *__''exp_dn''__, unsigned char *__''comp_dn''__, int__ ''length''__, unsigned char **__''dnptrs''__, unsigned char *__''exp_dn''__, unsigned char **__''lastdnptr''__); int dn_expand(unsigned char *__''msg''__, unsigned char *__''eomorig''__, unsigned char *__''comp_dn''__, unsigned char *__''exp_dn''__, int__ ''length''__); __ !!DESCRIPTION These functions make queries to and interpret the responses from Internet domain name servers. The __res_init()__ function reads the configuration files (see resolv+(8)) 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. The __res_query()__ function queries the name server for the fully-qualified domain name ''name'' of specified ''type'' and ''class''. The reply is left in the buffer ''answer'' of length ''anslen'' supplied by the caller. The __res_search()__ function makes a query and waits for the response like __res_query()__, but in addition implements the default and search rules controlled by RES_DEFNAMES and RES_DNSRCH (see description of ''_res'' options below). The __res_querydomain()__ function makes a query using __res_query()__ on the concatenation of ''name'' and ''domain''. The following functions are lower-level routines used by __res_query()__. The __res_mkquery()__ 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 ''''. ''newrr'' is currently unused. The __res_send()__ 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()__, if it has not already been called. 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. The dn_expand() 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. The resolver routines use global configuration and state information contained in the structure ''_res'', which is defined in ''''. 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()__ 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()__. [[Enabled by default]. __RES_DEFNAMES__ If set, __res_search()__ 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()__ will search for host names in the current domain and in parent domains. This option is used by gethostbyname(3). [[Enabled by default]. !!RETURN VALUE The __res_init()__ function returns 0 on success, or -1 if an error occurs. The __res_query()__, __res_search()__, __res_querydomain()__, __res_mkquery()__ and __res_send()__ functions return the length of the response, or -1 if an error occurs. The __dn_comp()__ and __dn_expand()__ functions return the length of the compressed name, or -1 if an error occurs. !!FILES /etc/resolv.conf resolver configuration file /etc/host.conf resolver configuration file !!CONFORMING TO BSD 4.3 !!SEE ALSO gethostbyname(3), hostname(7), named(8), resolv+(8) ----
22 pages link to
resolver(3)
:
Man3r
sethostent(3)
endhostent(3)
aaaa(1)
gethostbyaddr(3)
dnsdomainname(1)
herror(3)
host(1)
hostname(1)
mx(1)
named-xfer(8)
ns(1)
nslookup(8)
resolv+(8)
resolver(5)
soa(1)
txt(1)
zone(1)
gethostbyname(3)
hosts(5)
resolv.conf(5)
named(8)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.