1bc7413d0SPeter Wemm.\" Copyright (c) 1985, 1991, 1993 2bc7413d0SPeter Wemm.\" The Regents of the University of California. All rights reserved. 3fdf4c7afSPeter Wemm.\" 4bc7413d0SPeter Wemm.\" Redistribution and use in source and binary forms, with or without 5bc7413d0SPeter Wemm.\" modification, are permitted provided that the following conditions 6bc7413d0SPeter Wemm.\" are met: 7bc7413d0SPeter Wemm.\" 1. Redistributions of source code must retain the above copyright 8bc7413d0SPeter Wemm.\" notice, this list of conditions and the following disclaimer. 9bc7413d0SPeter Wemm.\" 2. Redistributions in binary form must reproduce the above copyright 10bc7413d0SPeter Wemm.\" notice, this list of conditions and the following disclaimer in the 11bc7413d0SPeter Wemm.\" documentation and/or other materials provided with the distribution. 12bc7413d0SPeter Wemm.\" 3. All advertising materials mentioning features or use of this software 13bc7413d0SPeter Wemm.\" must display the following acknowledgement: 14bc7413d0SPeter Wemm.\" This product includes software developed by the University of 15bc7413d0SPeter Wemm.\" California, Berkeley and its contributors. 16bc7413d0SPeter Wemm.\" 4. Neither the name of the University nor the names of its contributors 17bc7413d0SPeter Wemm.\" may be used to endorse or promote products derived from this software 18bc7413d0SPeter Wemm.\" without specific prior written permission. 19fdf4c7afSPeter Wemm.\" 20bc7413d0SPeter Wemm.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21bc7413d0SPeter Wemm.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22bc7413d0SPeter Wemm.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23bc7413d0SPeter Wemm.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24bc7413d0SPeter Wemm.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25bc7413d0SPeter Wemm.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26bc7413d0SPeter Wemm.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27bc7413d0SPeter Wemm.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28bc7413d0SPeter Wemm.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29bc7413d0SPeter Wemm.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30bc7413d0SPeter Wemm.\" SUCH DAMAGE. 31fdf4c7afSPeter Wemm.\" 32bc7413d0SPeter Wemm.\" @(#)resolver.3 8.1 (Berkeley) 6/4/93 337f3dea24SPeter Wemm.\" $FreeBSD$ 34bc7413d0SPeter Wemm.\" 35bc7413d0SPeter Wemm.Dd June 4, 1993 36bc7413d0SPeter Wemm.Dt RESOLVER 3 37a307d598SRuslan Ermilov.Os 38bc7413d0SPeter Wemm.Sh NAME 39bc7413d0SPeter Wemm.Nm res_query , 40bc7413d0SPeter Wemm.Nm res_search , 41bc7413d0SPeter Wemm.Nm res_mkquery , 42bc7413d0SPeter Wemm.Nm res_send , 43bc7413d0SPeter Wemm.Nm res_init , 44bc7413d0SPeter Wemm.Nm dn_comp , 45b5b2871fSAnton Berezin.Nm dn_expand , 46b5b2871fSAnton Berezin.Nm dn_skipname , 47b5b2871fSAnton Berezin.Nm ns_get16 , 48b5b2871fSAnton Berezin.Nm ns_get32 , 49b5b2871fSAnton Berezin.Nm ns_put16 , 50b5b2871fSAnton Berezin.Nm ns_put32 51bc7413d0SPeter Wemm.Nd resolver routines 5225bb73e0SAlexey Zelkin.Sh LIBRARY 5325bb73e0SAlexey Zelkin.Lb libc 54bc7413d0SPeter Wemm.Sh SYNOPSIS 5532eef9aeSRuslan Ermilov.In sys/types.h 5632eef9aeSRuslan Ermilov.In netinet/in.h 5732eef9aeSRuslan Ermilov.In arpa/nameser.h 5832eef9aeSRuslan Ermilov.In resolv.h 591eda21cbSBruce Evans.Ft int 60bc7413d0SPeter Wemm.Fo res_query 61c293d821SPeter Wemm.Fa "const char *dname" 62bc7413d0SPeter Wemm.Fa "int class" 63bc7413d0SPeter Wemm.Fa "int type" 64bc7413d0SPeter Wemm.Fa "u_char *answer" 65bc7413d0SPeter Wemm.Fa "int anslen" 66bc7413d0SPeter Wemm.Fc 671eda21cbSBruce Evans.Ft int 68bc7413d0SPeter Wemm.Fo res_search 69c293d821SPeter Wemm.Fa "const char *dname" 70bc7413d0SPeter Wemm.Fa "int class" 71bc7413d0SPeter Wemm.Fa "int type" 72bc7413d0SPeter Wemm.Fa "u_char *answer" 73bc7413d0SPeter Wemm.Fa "int anslen" 74bc7413d0SPeter Wemm.Fc 751eda21cbSBruce Evans.Ft int 76bc7413d0SPeter Wemm.Fo res_mkquery 77bc7413d0SPeter Wemm.Fa "int op" 78c293d821SPeter Wemm.Fa "const char *dname" 79bc7413d0SPeter Wemm.Fa "int class" 80bc7413d0SPeter Wemm.Fa "int type" 811eda21cbSBruce Evans.Fa "const u_char *data" 82bc7413d0SPeter Wemm.Fa "int datalen" 831eda21cbSBruce Evans.Fa "const u_char *newrr_in" 841eda21cbSBruce Evans.Fa "u_char *buf" 85bc7413d0SPeter Wemm.Fa "int buflen" 86bc7413d0SPeter Wemm.Fc 871eda21cbSBruce Evans.Ft int 88bc7413d0SPeter Wemm.Fo res_send 8990afb6a5SBruce Evans.Fa "const u_char *msg" 90bc7413d0SPeter Wemm.Fa "int msglen" 9190afb6a5SBruce Evans.Fa "u_char *answer" 92bc7413d0SPeter Wemm.Fa "int anslen" 93bc7413d0SPeter Wemm.Fc 941eda21cbSBruce Evans.Ft int 95bc7413d0SPeter Wemm.Fn res_init 96b5b2871fSAnton Berezin.Ft int 97bc7413d0SPeter Wemm.Fo dn_comp 98c293d821SPeter Wemm.Fa "const char *exp_dn" 9990afb6a5SBruce Evans.Fa "u_char *comp_dn" 100bc7413d0SPeter Wemm.Fa "int length" 10190afb6a5SBruce Evans.Fa "u_char **dnptrs" 10290afb6a5SBruce Evans.Fa "u_char **lastdnptr" 103bc7413d0SPeter Wemm.Fc 1041eda21cbSBruce Evans.Ft int 105bc7413d0SPeter Wemm.Fo dn_expand 106c293d821SPeter Wemm.Fa "const u_char *msg" 107c293d821SPeter Wemm.Fa "const u_char *eomorig" 108c293d821SPeter Wemm.Fa "const u_char *comp_dn" 1091eda21cbSBruce Evans.Fa "char *exp_dn" 110bc7413d0SPeter Wemm.Fa "int length" 111bc7413d0SPeter Wemm.Fc 112b5b2871fSAnton Berezin.Ft int 113b5b2871fSAnton Berezin.Fn dn_skipname "const u_char *comp_dn" "const u_char *eom" 114b5b2871fSAnton Berezin.Ft u_int 115b5b2871fSAnton Berezin.Fn ns_get16 "const u_char *src" 116b5b2871fSAnton Berezin.Ft u_long 117b5b2871fSAnton Berezin.Fn ns_get32 "const u_char *src" 118b5b2871fSAnton Berezin.Ft void 119b5b2871fSAnton Berezin.Fn ns_put16 "u_int src" "u_char *dst" 120b5b2871fSAnton Berezin.Ft void 121b5b2871fSAnton Berezin.Fn ns_put32 "u_long src" "u_char *dst" 122bc7413d0SPeter Wemm.Sh DESCRIPTION 123fdf4c7afSPeter WemmThese routines are used for making, sending and interpreting 124fdf4c7afSPeter Wemmquery and reply messages with Internet domain name servers. 125bc7413d0SPeter Wemm.Pp 126fdf4c7afSPeter WemmGlobal configuration and state information that is used by the 127fdf4c7afSPeter Wemmresolver routines is kept in the structure 1285c564baeSRuslan Ermilov.Va _res . 129fdf4c7afSPeter WemmMost of the values have reasonable defaults and can be ignored. 130fdf4c7afSPeter WemmOptions 131fdf4c7afSPeter Wemmstored in 1325c564baeSRuslan Ermilov.Va _res.options 133fdf4c7afSPeter Wemmare defined in 134743d5d51SRuslan Ermilov.In resolv.h 135fdf4c7afSPeter Wemmand are as follows. 136fdf4c7afSPeter WemmOptions are stored as a simple bit mask containing the bitwise ``or'' 137fdf4c7afSPeter Wemmof the options enabled. 138ce6282dbSHajimu UMEMOTO.Bl -tag -width RES_USE_INET6 139bc7413d0SPeter Wemm.It Dv RES_INIT 140fdf4c7afSPeter WemmTrue if the initial name server address and default domain name are 141fdf4c7afSPeter Wemminitialized (i.e., 142bc7413d0SPeter Wemm.Fn res_init 143fdf4c7afSPeter Wemmhas been called). 144bc7413d0SPeter Wemm.It Dv RES_DEBUG 145fdf4c7afSPeter WemmPrint debugging messages. 146bc7413d0SPeter Wemm.It Dv RES_AAONLY 147fdf4c7afSPeter WemmAccept authoritative answers only. 148fdf4c7afSPeter WemmWith this option, 149bc7413d0SPeter Wemm.Fn res_send 150fdf4c7afSPeter Wemmshould continue until it finds an authoritative answer or finds an error. 151fdf4c7afSPeter WemmCurrently this is not implemented. 152bc7413d0SPeter Wemm.It Dv RES_USEVC 153bc7413d0SPeter WemmUse 154bc7413d0SPeter Wemm.Tn TCP 155bc7413d0SPeter Wemmconnections for queries instead of 156bc7413d0SPeter Wemm.Tn UDP 157bc7413d0SPeter Wemmdatagrams. 158bc7413d0SPeter Wemm.It Dv RES_STAYOPEN 159bc7413d0SPeter WemmUsed with 160bc7413d0SPeter Wemm.Dv RES_USEVC 161bc7413d0SPeter Wemmto keep the 162bc7413d0SPeter Wemm.Tn TCP 163bc7413d0SPeter Wemmconnection open between 164fdf4c7afSPeter Wemmqueries. 165fdf4c7afSPeter WemmThis is useful only in programs that regularly do many queries. 166bc7413d0SPeter Wemm.Tn UDP 167bc7413d0SPeter Wemmshould be the normal mode used. 168bc7413d0SPeter Wemm.It Dv RES_IGNTC 1690227791bSRuslan ErmilovUnused currently (ignore truncation errors, i.e., do not retry with 170bc7413d0SPeter Wemm.Tn TCP ) . 171bc7413d0SPeter Wemm.It Dv RES_RECURSE 172fdf4c7afSPeter WemmSet the recursion-desired bit in queries. 173fdf4c7afSPeter WemmThis is the default. 174bc7413d0SPeter Wemm.Pf ( Fn res_send 175fdf4c7afSPeter Wemmdoes not do iterative queries and expects the name server 176fdf4c7afSPeter Wemmto handle recursion.) 177bc7413d0SPeter Wemm.It Dv RES_DEFNAMES 178fdf4c7afSPeter WemmIf set, 179bc7413d0SPeter Wemm.Fn res_search 180fdf4c7afSPeter Wemmwill append the default domain name to single-component names 181fdf4c7afSPeter Wemm(those that do not contain a dot). 182fdf4c7afSPeter WemmThis option is enabled by default. 183bc7413d0SPeter Wemm.It Dv RES_DNSRCH 184fdf4c7afSPeter WemmIf this option is set, 185bc7413d0SPeter Wemm.Fn res_search 186fdf4c7afSPeter Wemmwill search for host names in the current domain and in parent domains; see 187bc7413d0SPeter Wemm.Xr hostname 7 . 188fdf4c7afSPeter WemmThis is used by the standard host lookup routine 189bc7413d0SPeter Wemm.Xr gethostbyname 3 . 190fdf4c7afSPeter WemmThis option is enabled by default. 191c293d821SPeter Wemm.It Dv RES_NOALIASES 192c293d821SPeter WemmThis option turns off the user level aliasing feature controlled by the 193c293d821SPeter Wemm.Dq Ev HOSTALIASES 1941a0a9345SRuslan Ermilovenvironment variable. 1951a0a9345SRuslan ErmilovNetwork daemons should set this option. 196ce6282dbSHajimu UMEMOTO.It Dv RES_USE_INET6 197ce6282dbSHajimu UMEMOTOEnables support for IPv6-only applications. 198ce6282dbSHajimu UMEMOTOThis causes IPv4 addresses to be returned as an IPv4 mapped address. 199c155ff5cSRuslan ErmilovFor example, 200c155ff5cSRuslan Ermilov.Li 10.1.1.1 201c155ff5cSRuslan Ermilovwill be returned as 202c155ff5cSRuslan Ermilov.Li ::ffff:10.1.1.1 . 203ce6282dbSHajimu UMEMOTOThe option is meaningful with certain kernel configuration only. 204ce6282dbSHajimu UMEMOTO.It Dv RES_USE_EDNS0 205ce6282dbSHajimu UMEMOTOEnables support for OPT pseudo-RR for EDNS0 extension. 206ce6282dbSHajimu UMEMOTOWith the option, resolver code will attach OPT pseudo-RR into DNS queries, 207ce6282dbSHajimu UMEMOTOto inform of our receive buffer size. 208ce6282dbSHajimu UMEMOTOThe option will allow DNS servers to take advantage of non-default receive 209ce6282dbSHajimu UMEMOTObuffer size, and to send larger replies. 210ce6282dbSHajimu UMEMOTODNS query packets with EDNS0 extension is not compatible with 211ce6282dbSHajimu UMEMOTOnon-EDNS0 DNS servers. 212bc7413d0SPeter Wemm.El 213bc7413d0SPeter Wemm.Pp 214fdf4c7afSPeter WemmThe 215bc7413d0SPeter Wemm.Fn res_init 216fdf4c7afSPeter Wemmroutine 217fdf4c7afSPeter Wemmreads the configuration file (if any; see 218bc7413d0SPeter Wemm.Xr resolver 5 ) 219fdf4c7afSPeter Wemmto get the default domain name, 220fdf4c7afSPeter Wemmsearch list and 221fdf4c7afSPeter Wemmthe Internet address of the local name server(s). 222fdf4c7afSPeter WemmIf no server is configured, the host running 223fdf4c7afSPeter Wemmthe resolver is tried. 224fdf4c7afSPeter WemmThe current domain name is defined by the hostname 225fdf4c7afSPeter Wemmif not specified in the configuration file; 226bc7413d0SPeter Wemmit can be overridden by the environment variable 227bc7413d0SPeter Wemm.Ev LOCALDOMAIN . 228c293d821SPeter WemmThis environment variable may contain several blank-separated 229c293d821SPeter Wemmtokens if you wish to override the 230c293d821SPeter Wemm.Em "search list" 2311a0a9345SRuslan Ermilovon a per-process basis. 2321a0a9345SRuslan ErmilovThis is similar to the 2335c564baeSRuslan Ermilov.Ic search 234c293d821SPeter Wemmcommand in the configuration file. 23594ba280cSRuslan ErmilovAnother environment variable 236c293d821SPeter Wemm.Dq Ev RES_OPTIONS 237c293d821SPeter Wemmcan be set to 238c293d821SPeter Wemmoverride certain internal resolver options which are otherwise 239c293d821SPeter Wemmset by changing fields in the 2405c564baeSRuslan Ermilov.Va _res 241c293d821SPeter Wemmstructure or are inherited from the configuration file's 2425c564baeSRuslan Ermilov.Ic options 2431a0a9345SRuslan Ermilovcommand. 2441a0a9345SRuslan ErmilovThe syntax of the 245c293d821SPeter Wemm.Dq Ev RES_OPTIONS 246c293d821SPeter Wemmenvironment variable is explained in 247c293d821SPeter Wemm.Xr resolver 5 . 248fdf4c7afSPeter WemmInitialization normally occurs on the first call 249bc7413d0SPeter Wemmto one of the following routines. 250bc7413d0SPeter Wemm.Pp 251fdf4c7afSPeter WemmThe 252bc7413d0SPeter Wemm.Fn res_query 253fdf4c7afSPeter Wemmfunction provides an interface to the server query mechanism. 254fdf4c7afSPeter WemmIt constructs a query, sends it to the local server, 255fdf4c7afSPeter Wemmawaits a response, and makes preliminary checks on the reply. 256fdf4c7afSPeter WemmThe query requests information of the specified 257bc7413d0SPeter Wemm.Fa type 258fdf4c7afSPeter Wemmand 259bc7413d0SPeter Wemm.Fa class 260fdf4c7afSPeter Wemmfor the specified fully-qualified domain name 261bc7413d0SPeter Wemm.Fa dname . 262fdf4c7afSPeter WemmThe reply message is left in the 263bc7413d0SPeter Wemm.Fa answer 264fdf4c7afSPeter Wemmbuffer with length 265bc7413d0SPeter Wemm.Fa anslen 266fdf4c7afSPeter Wemmsupplied by the caller. 267bc7413d0SPeter Wemm.Pp 268fdf4c7afSPeter WemmThe 269bc7413d0SPeter Wemm.Fn res_search 270fdf4c7afSPeter Wemmroutine makes a query and awaits a response like 271bc7413d0SPeter Wemm.Fn res_query , 272fdf4c7afSPeter Wemmbut in addition, it implements the default and search rules 273bc7413d0SPeter Wemmcontrolled by the 274bc7413d0SPeter Wemm.Dv RES_DEFNAMES 275bc7413d0SPeter Wemmand 276bc7413d0SPeter Wemm.Dv RES_DNSRCH 277bc7413d0SPeter Wemmoptions. 278fdf4c7afSPeter WemmIt returns the first successful reply. 279bc7413d0SPeter Wemm.Pp 280fdf4c7afSPeter WemmThe remaining routines are lower-level routines used by 281bc7413d0SPeter Wemm.Fn res_query . 282fdf4c7afSPeter WemmThe 283bc7413d0SPeter Wemm.Fn res_mkquery 284fdf4c7afSPeter Wemmfunction 285fdf4c7afSPeter Wemmconstructs a standard query message and places it in 286bc7413d0SPeter Wemm.Fa buf . 287fdf4c7afSPeter WemmIt returns the size of the query, or \-1 if the query is 288fdf4c7afSPeter Wemmlarger than 289bc7413d0SPeter Wemm.Fa buflen . 290fdf4c7afSPeter WemmThe query type 291bc7413d0SPeter Wemm.Fa op 292bc7413d0SPeter Wemmis usually 293bc7413d0SPeter Wemm.Dv QUERY , 294bc7413d0SPeter Wemmbut can be any of the query types defined in 295fe08efe6SRuslan Ermilov.In arpa/nameser.h . 296fdf4c7afSPeter WemmThe domain name for the query is given by 297bc7413d0SPeter Wemm.Fa dname . 2982efeeba5SRuslan ErmilovThe 2992efeeba5SRuslan Ermilov.Fa newrr_in 3002efeeba5SRuslan Ermilovargument 301fdf4c7afSPeter Wemmis currently unused but is intended for making update messages. 302bc7413d0SPeter Wemm.Pp 303fdf4c7afSPeter WemmThe 304bc7413d0SPeter Wemm.Fn res_send 305fdf4c7afSPeter Wemmroutine 306fdf4c7afSPeter Wemmsends a pre-formatted query and returns an answer. 307fdf4c7afSPeter WemmIt will call 308bc7413d0SPeter Wemm.Fn res_init 309bc7413d0SPeter Wemmif 310bc7413d0SPeter Wemm.Dv RES_INIT 311bc7413d0SPeter Wemmis not set, send the query to the local name server, and 312fdf4c7afSPeter Wemmhandle timeouts and retries. 313fdf4c7afSPeter WemmThe length of the reply message is returned, or 314fdf4c7afSPeter Wemm\-1 if there were errors. 315bc7413d0SPeter Wemm.Pp 316fdf4c7afSPeter WemmThe 317bc7413d0SPeter Wemm.Fn dn_comp 318fdf4c7afSPeter Wemmfunction 319fdf4c7afSPeter Wemmcompresses the domain name 320bc7413d0SPeter Wemm.Fa exp_dn 321fdf4c7afSPeter Wemmand stores it in 322bc7413d0SPeter Wemm.Fa comp_dn . 323fdf4c7afSPeter WemmThe size of the compressed name is returned or \-1 if there were errors. 324fdf4c7afSPeter WemmThe size of the array pointed to by 325bc7413d0SPeter Wemm.Fa comp_dn 326fdf4c7afSPeter Wemmis given by 327bc7413d0SPeter Wemm.Fa length . 328fdf4c7afSPeter WemmThe compression uses 329fdf4c7afSPeter Wemman array of pointers 330bc7413d0SPeter Wemm.Fa dnptrs 331fdf4c7afSPeter Wemmto previously-compressed names in the current message. 332fdf4c7afSPeter WemmThe first pointer points to 33343d1df33SAlexander Langerthe beginning of the message and the list ends with 334bc7413d0SPeter Wemm.Dv NULL . 335fdf4c7afSPeter WemmThe limit to the array is specified by 336bc7413d0SPeter Wemm.Fa lastdnptr . 337fdf4c7afSPeter WemmA side effect of 338bc7413d0SPeter Wemm.Fn dn_comp 339fdf4c7afSPeter Wemmis to update the list of pointers for 340fdf4c7afSPeter Wemmlabels inserted into the message 341fdf4c7afSPeter Wemmas the name is compressed. 342fdf4c7afSPeter WemmIf 3435c564baeSRuslan Ermilov.Fa dnptr 344bc7413d0SPeter Wemmis 345d0353b83SRuslan Ermilov.Dv NULL , 346d0353b83SRuslan Ermilovnames are not compressed. 347fdf4c7afSPeter WemmIf 348bc7413d0SPeter Wemm.Fa lastdnptr 349bc7413d0SPeter Wemmis 350bc7413d0SPeter Wemm.Dv NULL , 351bc7413d0SPeter Wemmthe list of labels is not updated. 352bc7413d0SPeter Wemm.Pp 353fdf4c7afSPeter WemmThe 354bc7413d0SPeter Wemm.Fn dn_expand 355fdf4c7afSPeter Wemmentry 356fdf4c7afSPeter Wemmexpands the compressed domain name 357bc7413d0SPeter Wemm.Fa comp_dn 358fdf4c7afSPeter Wemmto a full domain name 359fdf4c7afSPeter WemmThe compressed name is contained in a query or reply message; 360bc7413d0SPeter Wemm.Fa msg 361fdf4c7afSPeter Wemmis a pointer to the beginning of the message. 362fdf4c7afSPeter WemmThe uncompressed name is placed in the buffer indicated by 363bc7413d0SPeter Wemm.Fa exp_dn 364fdf4c7afSPeter Wemmwhich is of size 365bc7413d0SPeter Wemm.Fa length . 366fdf4c7afSPeter WemmThe size of compressed name is returned or \-1 if there was an error. 367b5b2871fSAnton Berezin.Pp 368b5b2871fSAnton BerezinThe 369b5b2871fSAnton Berezin.Fn dn_skipname 370b5b2871fSAnton Berezinfunction skips over a compressed domain name, which starts at a location 371b5b2871fSAnton Berezinpointed to by 372b5b2871fSAnton Berezin.Fa comp_dn . 373b5b2871fSAnton BerezinThe compressed name is contained in a query or reply message; 374b5b2871fSAnton Berezin.Fa eom 375b5b2871fSAnton Berezinis a pointer to the end of the message. 376b5b2871fSAnton BerezinThe size of compressed name is returned or \-1 if there was 377b5b2871fSAnton Berezinan error. 378b5b2871fSAnton Berezin.Pp 379b5b2871fSAnton BerezinThe 380b5b2871fSAnton Berezin.Fn ns_get16 381b5b2871fSAnton Berezinfunction gets a 16-bit quantity from a buffer pointed to by 382b5b2871fSAnton Berezin.Fa src . 383b5b2871fSAnton Berezin.Pp 384b5b2871fSAnton BerezinThe 385b5b2871fSAnton Berezin.Fn ns_get32 386b5b2871fSAnton Berezinfunction gets a 32-bit quantity from a buffer pointed to by 387b5b2871fSAnton Berezin.Fa src . 388b5b2871fSAnton Berezin.Pp 389b5b2871fSAnton BerezinThe 390b5b2871fSAnton Berezin.Fn ns_put16 391b5b2871fSAnton Berezinfunction puts a 16-bit quantity 392b5b2871fSAnton Berezin.Fa src 393b5b2871fSAnton Berezinto a buffer pointed to by 394b5b2871fSAnton Berezin.Fa dst . 395b5b2871fSAnton Berezin.Pp 396b5b2871fSAnton BerezinThe 397b5b2871fSAnton Berezin.Fn ns_put32 398b5b2871fSAnton Berezinfunction puts a 32-bit quantity 399b5b2871fSAnton Berezin.Fa src 400b5b2871fSAnton Berezinto a buffer pointed to by 401b5b2871fSAnton Berezin.Fa dst . 40233dee819SBrian Feldman.Sh IMPLEMENTATION NOTES 40333dee819SBrian FeldmanThis implementation of the resolver is thread-safe, but it will not 40433dee819SBrian Feldmanfunction properly if the programmer attempts to declare his or her own 40533dee819SBrian Feldman.Va _res 40633dee819SBrian Feldmanstructure in an attempt to replace the per-thread version referred to 40733dee819SBrian Feldmanby that macro. 40824a0682cSRuslan Ermilov.Sh RETURN VALUES 40924a0682cSRuslan ErmilovThe 41024a0682cSRuslan Ermilov.Fn res_init 41124a0682cSRuslan Ermilovfunction will return 0 on success, or \-1 in a threaded program if 41224a0682cSRuslan Ermilovper-thread storage could not be allocated. 413bc7413d0SPeter Wemm.Sh FILES 41442635956SRuslan Ermilov.Bl -tag -width /etc/resolv.conf 41542635956SRuslan Ermilov.It Pa /etc/resolv.conf 41642635956SRuslan ErmilovThe configuration file, 417bc7413d0SPeter Wemmsee 418bc7413d0SPeter Wemm.Xr resolver 5 . 419bc7413d0SPeter Wemm.El 420bc7413d0SPeter Wemm.Sh SEE ALSO 421bc7413d0SPeter Wemm.Xr gethostbyname 3 , 422bc7413d0SPeter Wemm.Xr resolver 5 , 423bc7413d0SPeter Wemm.Xr hostname 7 , 42475141cc9SWolfram Schneider.Xr named 8 425bc7413d0SPeter Wemm.Pp 426bc7413d0SPeter Wemm.%T RFC1032 , 427bc7413d0SPeter Wemm.%T RFC1033 , 428bc7413d0SPeter Wemm.%T RFC1034 , 429bc7413d0SPeter Wemm.%T RFC1035 , 430bc7413d0SPeter Wemm.%T RFC974 431bc7413d0SPeter Wemm.Rs 432bc7413d0SPeter Wemm.%T "Name Server Operations Guide for BIND" 433bc7413d0SPeter Wemm.Re 434bc7413d0SPeter Wemm.Sh HISTORY 435fdf4c7afSPeter WemmThe 436bc7413d0SPeter Wemm.Nm 437bc7413d0SPeter Wemmfunction appeared in 438bc7413d0SPeter Wemm.Bx 4.3 . 439