1RESOLVER(3) FreeBSD Library Functions Manual RESOLVER(3) 2 3NNAAMMEE 4 rreess__nniinniitt, rreess__oouurrsseerrvveerr__pp, ffpp__rreessssttaatt, rreess__hhoossttaalliiaass, rreess__ppqquueerryy, 5 rreess__nnqquueerryy, rreess__nnsseeaarrcchh, rreess__nnqquueerryyddoommaaiinn, rreess__nnmmkkqquueerryy, rreess__nnsseenndd, 6 rreess__nnuuppddaattee, rreess__nnmmkkuuppddaattee, rreess__nncclloossee, rreess__nnsseennddssiiggnneedd, rreess__ffiinnddzzoonneeccuutt, 7 rreess__ggeettsseerrvveerrss, rreess__sseettsseerrvveerrss, rreess__nnddeessttrrooyy, ddnn__ccoommpp, ddnn__eexxppaanndd, 8 hhssttrreerrrroorr, rreess__iinniitt, rreess__iissoouurrsseerrvveerr, ffpp__nnqquueerryy, pp__qquueerryy, hhoossttaalliiaass, 9 rreess__qquueerryy, rreess__sseeaarrcchh, rreess__qquueerryyddoommaaiinn, rreess__mmkkqquueerryy, rreess__sseenndd, 10 rreess__uuppddaattee, rreess__cclloossee, hheerrrroorr -- resolver routines 11 12SSYYNNOOPPSSIISS 13 ##iinncclluuddee <<ssyyss//ttyyppeess..hh>> 14 ##iinncclluuddee <<nneettiinneett//iinn..hh>> 15 ##iinncclluuddee <<aarrppaa//nnaammeesseerr..hh>> 16 ##iinncclluuddee <<rreessoollvv..hh>> 17 ##iinncclluuddee <<rreess__uuppddaattee..hh>> 18 19 _t_y_p_e_d_e_f _s_t_r_u_c_t _____r_e_s___s_t_a_t_e _*_r_e_s___s_t_a_t_e; 20 21 _i_n_t 22 rreess__nniinniitt(_r_e_s___s_t_a_t_e _s_t_a_t_p); 23 24 _i_n_t 25 rreess__oouurrsseerrvveerr__pp(_c_o_n_s_t _r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _s_t_r_u_c_t _s_o_c_k_a_d_d_r___i_n _*_a_d_d_r); 26 27 _v_o_i_d 28 ffpp__rreessssttaatt(_c_o_n_s_t _r_e_s___s_t_a_t_e _s_t_a_t_p, _F_I_L_E _*_f_p); 29 30 _c_o_n_s_t _c_h_a_r _* 31 rreess__hhoossttaalliiaass(_c_o_n_s_t _r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _c_h_a_r _*_n_a_m_e, _c_h_a_r _*_b_u_f, 32 _s_i_z_e___t _b_u_f_l_e_n); 33 34 _i_n_t 35 rreess__ppqquueerryy(_c_o_n_s_t _r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _u___c_h_a_r _*_m_s_g, _i_n_t _m_s_g_l_e_n, 36 _F_I_L_E _*_f_p); 37 38 _i_n_t 39 rreess__nnqquueerryy(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, 40 _u___c_h_a_r _*_a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 41 42 _i_n_t 43 rreess__nnsseeaarrcchh(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, 44 _u___c_h_a_r _* _a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 45 46 _i_n_t 47 rreess__nnqquueerryyddoommaaiinn(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _c_h_a_r _*_n_a_m_e, _c_o_n_s_t _c_h_a_r _*_d_o_m_a_i_n, 48 _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, _u___c_h_a_r _*_a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 49 50 _i_n_t 51 rreess__nnmmkkqquueerryy(_r_e_s___s_t_a_t_e _s_t_a_t_p, _i_n_t _o_p, _c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, 52 _i_n_t _t_y_p_e, _c_o_n_s_t _u___c_h_a_r _*_d_a_t_a, _i_n_t _d_a_t_a_l_e_n, _c_o_n_s_t _u___c_h_a_r _*_n_e_w_r_r, 53 _u___c_h_a_r _*_b_u_f, _i_n_t _b_u_f_l_e_n); 54 55 _i_n_t 56 rreess__nnsseenndd(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _u___c_h_a_r _*_m_s_g, _i_n_t _m_s_g_l_e_n, _u___c_h_a_r _*_a_n_s_w_e_r, 57 _i_n_t _a_n_s_l_e_n); 58 59 _i_n_t 60 rreess__nnuuppddaattee(_r_e_s___s_t_a_t_e _s_t_a_t_p, _n_s___u_p_d_r_e_c _*_r_r_e_c_p___i_n); 61 62 _i_n_t 63 rreess__nnmmkkuuppddaattee(_r_e_s___s_t_a_t_e _s_t_a_t_p, _n_s___u_p_d_r_e_c _*_r_r_e_c_p___i_n, _u___c_h_a_r _*_b_u_f, 64 _i_n_t _b_u_f_l_e_n); 65 66 _v_o_i_d 67 rreess__nncclloossee(_r_e_s___s_t_a_t_e _s_t_a_t_p); 68 69 _i_n_t 70 rreess__nnsseennddssiiggnneedd(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _u___c_h_a_r _*_m_s_g, _i_n_t _m_s_g_l_e_n, 71 _n_s___t_s_i_g___k_e_y _*_k_e_y, _u___c_h_a_r _*_a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 72 73 _i_n_t 74 rreess__ffiinnddzzoonneeccuutt(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _n_s___c_l_a_s_s _c_l_a_s_s, 75 _i_n_t _o_p_t_i_o_n_s, _c_h_a_r _*_z_n_a_m_e, _s_i_z_e___t _z_s_i_z_e, _s_t_r_u_c_t _i_n___a_d_d_r _*_a_d_d_r_s, 76 _i_n_t _n_a_d_d_r_s); 77 78 _i_n_t 79 rreess__ggeettsseerrvveerrss(_r_e_s___s_t_a_t_e _s_t_a_t_p, _u_n_i_o_n _r_e_s___s_o_c_k_a_d_d_r___u_n_i_o_n _*_s_e_t, _i_n_t _c_n_t); 80 81 _v_o_i_d 82 rreess__sseettsseerrvveerrss(_r_e_s___s_t_a_t_e _s_t_a_t_p, _c_o_n_s_t _u_n_i_o_n _r_e_s___s_o_c_k_a_d_d_r___u_n_i_o_n _*_s_e_t, 83 _i_n_t _c_n_t); 84 85 _v_o_i_d 86 rreess__nnddeessttrrooyy(_r_e_s___s_t_a_t_e _s_t_a_t_p); 87 88 _i_n_t 89 ddnn__ccoommpp(_c_o_n_s_t _c_h_a_r _*_e_x_p___d_n, _u___c_h_a_r _*_c_o_m_p___d_n, _i_n_t _l_e_n_g_t_h, _u___c_h_a_r _*_*_d_n_p_t_r_s, 90 _u___c_h_a_r _*_*_l_a_s_t_d_n_p_t_r); 91 92 _i_n_t 93 ddnn__eexxppaanndd(_c_o_n_s_t _u___c_h_a_r _*_m_s_g, _c_o_n_s_t _u___c_h_a_r _*_e_o_m_o_r_i_g, 94 _c_o_n_s_t _u___c_h_a_r _*_c_o_m_p___d_n, _c_h_a_r _*_e_x_p___d_n, _i_n_t _l_e_n_g_t_h); 95 96 _c_o_n_s_t _c_h_a_r _* 97 hhssttrreerrrroorr(_i_n_t _e_r_r); 98 99 DDEEPPRREECCAATTEEDD 100 ##iinncclluuddee <<ssyyss//ttyyppeess..hh>> 101 ##iinncclluuddee <<nneettiinneett//iinn..hh>> 102 ##iinncclluuddee <<aarrppaa//nnaammeesseerr..hh>> 103 ##iinncclluuddee <<rreessoollvv..hh>> 104 ##iinncclluuddee <<rreess__uuppddaattee..hh>> 105 106 _i_n_t 107 rreess__iinniitt(_v_o_i_d); 108 109 _i_n_t 110 rreess__iissoouurrsseerrvveerr(_c_o_n_s_t _s_t_r_u_c_t _s_o_c_k_a_d_d_r___i_n _*_a_d_d_r); 111 112 _i_n_t 113 ffpp__nnqquueerryy(_c_o_n_s_t _u___c_h_a_r _*_m_s_g, _i_n_t _m_s_g_l_e_n, _F_I_L_E _*_f_p); 114 115 _v_o_i_d 116 pp__qquueerryy(_c_o_n_s_t _u___c_h_a_r _*_m_s_g, _F_I_L_E _*_f_p); 117 118 _c_o_n_s_t _c_h_a_r _* 119 hhoossttaalliiaass(_c_o_n_s_t _c_h_a_r _*_n_a_m_e); 120 121 _i_n_t 122 rreess__qquueerryy(_c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, _u___c_h_a_r _*_a_n_s_w_e_r, 123 _i_n_t _a_n_s_l_e_n); 124 125 _i_n_t 126 rreess__sseeaarrcchh(_c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, _u___c_h_a_r _*_a_n_s_w_e_r, 127 _i_n_t _a_n_s_l_e_n); 128 129 _i_n_t 130 rreess__qquueerryyddoommaaiinn(_c_o_n_s_t _c_h_a_r _*_n_a_m_e, _c_o_n_s_t _c_h_a_r _*_d_o_m_a_i_n, _i_n_t _c_l_a_s_s, 131 _i_n_t _t_y_p_e, _u___c_h_a_r _*_a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 132 133 _i_n_t 134 rreess__mmkkqquueerryy(_i_n_t _o_p, _c_o_n_s_t _c_h_a_r _*_d_n_a_m_e, _i_n_t _c_l_a_s_s, _i_n_t _t_y_p_e, 135 _c_o_n_s_t _c_h_a_r _*_d_a_t_a, _i_n_t _d_a_t_a_l_e_n, _s_t_r_u_c_t _r_r_e_c _*_n_e_w_r_r, _u___c_h_a_r _*_b_u_f, 136 _i_n_t _b_u_f_l_e_n); 137 138 _i_n_t 139 rreess__sseenndd(_c_o_n_s_t _u___c_h_a_r _*_m_s_g, _i_n_t _m_s_g_l_e_n, _u___c_h_a_r _*_a_n_s_w_e_r, _i_n_t _a_n_s_l_e_n); 140 141 _i_n_t 142 rreess__uuppddaattee(_n_s___u_p_d_r_e_c _*_r_r_e_c_p___i_n); 143 144 _v_o_i_d 145 rreess__cclloossee(_v_o_i_d); 146 147 _v_o_i_d 148 hheerrrroorr(_c_o_n_s_t _c_h_a_r _*_s); 149 150DDEESSCCRRIIPPTTIIOONN 151 These routines are used for making, sending and interpreting query and 152 reply messages with Internet domain name servers. 153 154 State information is kept in _s_t_a_t_p and is used to control the behavior of 155 these functions. _s_t_a_t_p should be set to all zeros prior to the first 156 call to any of these functions. 157 158 The functions rreess__iinniitt(), rreess__iissoouurrsseerrvveerr(), ffpp__nnqquueerryy(), pp__qquueerryy(), 159 hhoossttaalliiaass(), rreess__qquueerryy(), rreess__sseeaarrcchh(), rreess__qquueerryyddoommaaiinn(), rreess__mmkkqquueerryy(), 160 rreess__sseenndd(), rreess__uuppddaattee(), rreess__cclloossee() and hheerrrroorr() are deprecated and are 161 supplied for compatability with old source code. They use global config- 162 uration and state information that is kept in the structure ___r_e_s rather 163 than that referenced through _s_t_a_t_p. 164 165 Most of the values in _s_t_a_t_p and ___r_e_s are initialized on the first call to 166 rreess__nniinniitt() / rreess__iinniitt() to reasonable defaults and can be ignored. 167 Options stored in _s_t_a_t_p_-_>_o_p_t_i_o_n_s / ___r_e_s_._o_p_t_i_o_n_s are defined in _r_e_s_o_l_v_._h 168 and are as follows. Options are stored as a simple bit mask containing 169 the bitwise ``OR'' of the options enabled. 170 171 RES_INIT 172 True if the initial name server address and default domain name 173 are initialized (i.e., rreess__nniinniitt() / rreess__iinniitt() has been 174 called). 175 176 RES_DEBUG 177 Print debugging messages. 178 179 RES_AAONLY 180 Accept authoritative answers only. Should continue until it 181 finds an authoritative answer or finds an error. Currently this 182 is not implemented. 183 184 RES_USEVC 185 Use TCP connections for queries instead of UDP datagrams. 186 187 RES_STAYOPEN 188 Used with RES_USEVC to keep the TCP connection open between 189 queries. This is useful only in programs that regularly do many 190 queries. UDP should be the normal mode used. 191 192 RES_IGNTC 193 Ignore truncation errors, i.e., don't retry with TCP. 194 195 RES_RECURSE 196 Set the recursion-desired bit in queries. This is the default. 197 (rreess__nnsseenndd() / rreess__sseenndd() does not do iterative queries and 198 expects the name server to handle recursion.) 199 200 RES_DEFNAMES 201 If set, rreess__nnsseeaarrcchh() / rreess__sseeaarrcchh() will append the default 202 domain name to single-component names (those that do not contain 203 a dot). This option is enabled by default. 204 205 RES_DNSRCH 206 If this option is set, rreess__nnsseeaarrcchh() / rreess__sseeaarrcchh() will search 207 for host names in the current domain and in parent domains; see 208 hostname(7). This is used by the standard host lookup routine 209 gethostbyname(3). This option is enabled by default. 210 211 RES_NOALIASES 212 This option turns off the user level aliasing feature controlled 213 by the HOSTALIASES environment variable. Network daemons should 214 set this option. 215 216 RES_USE_INET6 217 This option causes gethostbyname(3) to look for AAAA records 218 before looking for A records if none are found. 219 220 RES_ROTATE 221 This options causes the rreess__nnsseenndd() / rreess__sseenndd() to rotate the 222 list of nameservers in _s_t_a_t_p_-_>_n_s_a_d_d_r___l_i_s_t / ___r_e_s_._n_s_a_d_d_r___l_i_s_t. 223 224 RES_KEEPTSIG 225 This option causes rreess__nnsseennddssiiggnneedd() to leave the message 226 unchanged after TSIG verification; otherwise the TSIG record 227 would be removed and the header updated. 228 229 RES_NOTLDQUERY 230 This option causes rreess__nnsseeaarrcchh() to not attempt to resolve a 231 unqualified name as if it were a top level domain (TLD). This 232 option can cause problems if the site has "localhost" as a TLD 233 rather than having localhost on one or more elements of the 234 search list. This option has no effect if neither RES_DEFNAMES 235 or RES_DNSRCH is set. 236 237 The rreess__nniinniitt() / rreess__iinniitt() routine reads the configuration file (if 238 any; see resolver(5)) to get the default domain name, search list and the 239 Internet address of the local name server(s). If no server is config- 240 ured, the host running the resolver is tried. The current domain name is 241 defined by the hostname if not specified in the configuration file; it 242 can be overridden by the environment variable LOCALDOMAIN. This environ- 243 ment variable may contain several blank-separated tokens if you wish to 244 override the ``search list'' on a per-process basis. This is similar to 245 the sseeaarrcchh command in the configuration file. Another environment vari- 246 able (``RES_OPTIONS'') can be set to override certain internal resolver 247 options which are otherwise set by changing fields in the _s_t_a_t_p / ___r_e_s 248 structure or are inherited from the configuration file's ooppttiioonnss command. 249 The syntax of the ``RES_OPTIONS'' environment variable is explained in 250 resolver(5). Initialization normally occurs on the first call to one of 251 the other resolver routines. 252 253 The memory referred to by _s_t_a_t_p must be set to all zeros prior to the 254 first call to rreess__nniinniitt(). rreess__nnddeessttrrooyy() should be call to free memory 255 allocated by rreess__nniinniitt() after last use. 256 257 The rreess__nnqquueerryy() / rreess__qquueerryy() functions provides interfaces to the 258 server query mechanism. They constructs a query, sends it to the local 259 server, awaits a response, and makes preliminary checks on the reply. 260 The query requests information of the specified _t_y_p_e and _c_l_a_s_s for the 261 specified fully-qualified domain name _d_n_a_m_e. The reply message is left 262 in the _a_n_s_w_e_r buffer with length _a_n_s_l_e_n supplied by the caller. 263 rreess__nnqquueerryy() / rreess__qquueerryy() return -1 on error or the length of the 264 answer. 265 266 The rreess__nnsseeaarrcchh() / rreess__sseeaarrcchh() routines make a query and awaits a 267 response like rreess__nnqquueerryy() / rreess__qquueerryy(), but in addition, it implements 268 the default and search rules controlled by the RES_DEFNAMES and 269 RES_DNSRCH options. It returns the length of the first successful reply 270 which is stored in _a_n_s_w_e_r or -1 on error. 271 272 The remaining routines are lower-level routines used by rreess__nnqquueerryy() / 273 rreess__qquueerryy(). The rreess__nnmmkkqquueerryy() / rreess__mmkkqquueerryy() functions constructs a 274 standard query message and places it in _b_u_f. It returns the size of the 275 query, or -1 if the query is larger than _b_u_f_l_e_n. The query type _o_p is 276 usually QUERY, but can be any of the query types defined in 277 _<_a_r_p_a_/_n_a_m_e_s_e_r_._h_>. The domain name for the query is given by _d_n_a_m_e. 278 _N_e_w_r_r is currently unused but is intended for making update messages. 279 280 The rreess__nnsseenndd() / rreess__sseenndd() / rreess__nnsseennddssiiggnneedd() routines sends a pre- 281 formatted query and returns an answer. It will call rreess__nniinniitt() / 282 rreess__iinniitt() if RES_INIT is not set, send the query to the local name 283 server, and handle timeouts and retries. Additionally, rreess__nnsseennddssiiggnneedd() 284 will use TSIG signatures to add authentication to the query and verify 285 the response. In this case, only one nameserver will be contacted. The 286 length of the reply message is returned, or -1 if there were errors. 287 288 rreess__nnqquueerryy() / rreess__qquueerryy(), rreess__nnsseeaarrcchh() / rreess__sseeaarrcchh() and rreess__nnsseenndd() 289 / rreess__sseenndd() return a length that may be bigger than _a_n_s_l_e_n. In that 290 case the query should be retried with a bigger buffer. NOTE the answer 291 to the second query may be larger still so supplying a buffer that bigger 292 that the answer returned by the previous query is recommended. 293 294 _a_n_s_w_e_r MUST be big enough to receive a maximum UDP response from the 295 server or parts of the answer will be silently discarded. The default 296 maximum UDP response size is 512 bytes. 297 298 The function rreess__oouurrsseerrvveerr__pp() returns true when _i_n_p is one of the 299 servers in _s_t_a_t_p_-_>_n_s_a_d_d_r___l_i_s_t / ___r_e_s_._n_s_a_d_d_r___l_i_s_t. 300 301 The functions ffpp__nnqquueerryy() / pp__qquueerryy() print out the query and any answer 302 in _m_s_g on _f_p. pp__qquueerryy() is equivalent to ffpp__nnqquueerryy() with _m_s_g_l_e_n set to 303 512. 304 305 The function ffpp__rreessssttaatt() prints out the active flag bits in 306 _s_t_a_t_p_-_>_o_p_t_i_o_n_s preceeded by the text ";; res options:" on _f_i_l_e. 307 308 The functions rreess__hhoossttaalliiaass() / hhoossttaalliiaass() lookup up name in the file 309 referred to by the HOSTALIASES files return a fully qualified hostname if 310 found or NULL if not found or an error occurred. rreess__hhoossttaalliiaass() uses 311 _b_u_f to store the result in, hhoossttaalliiaass() uses a static buffer. 312 313 The functions rreess__ggeettsseerrvveerrss() and rreess__sseettsseerrvveerrss() are used to get and 314 set the list of server to be queried. 315 316 The functions rreess__nnuuppddaattee() / rreess__uuppddaattee() take a list of ns_updrec 317 _r_r_e_c_p___i_n. Identifies the containing zone for each record and groups the 318 records according to containing zone maintaining in zone order then sends 319 and update request to the servers for these zones. The number of zones 320 updated is returned or -1 on error. Note that rreess__nnuuppddaattee() will perform 321 TSIG authenticated dynamic update operations if the key is not NULL. 322 323 The function rreess__ffiinnddzzoonneeccuutt() discovers the closest enclosing zone cut 324 for a specified domain name, and finds the IP addresses of the zone's 325 master servers. 326 327 The functions rreess__nnmmkkuuppddaattee() / rreess__mmkkuuppddaattee() take a linked list of 328 ns_updrec _r_r_e_c_p___i_n and construct a UPDATE message in _b_u_f. 329 rreess__nnmmkkuuppddaattee() / rreess__mmkkuuppddaattee() return the length of the constructed 330 message on no error or one of the following error values. 331 332 -1 An error occurred parsing _r_r_e_c_p___i_n. 333 334 -2 The buffer _b_u_f was too small. 335 336 -3 The first record was not a zone section or there was a section order 337 problem. The section order is S_ZONE, S_PREREQ and S_UPDATE. 338 339 -4 A number overflow occurred. 340 341 -5 Unknown operation or no records. 342 343 The functions rreess__nncclloossee() / rreess__cclloossee() close any open files referenced 344 through _s_t_a_t_p / ___r_e_s. 345 346 The function rreess__nnddeessttrrooyy() calls rreess__nncclloossee() then frees any memory 347 allocated by rreess__nniinniitt(). 348 349 The ddnn__ccoommpp() function compresses the domain name _e_x_p___d_n and stores it in 350 _c_o_m_p___d_n. The size of the compressed name is returned or -1 if there were 351 errors. The size of the array pointed to by _c_o_m_p___d_n is given by _l_e_n_g_t_h. 352 The compression uses an array of pointers _d_n_p_t_r_s to previously-compressed 353 names in the current message. The first pointer points to to the begin- 354 ning of the message and the list ends with NULL. The limit to the array 355 is specified by _l_a_s_t_d_n_p_t_r. A side effect of ddnn__ccoommpp() is to update the 356 list of pointers for labels inserted into the message as the name is com- 357 pressed. If _d_n_p_t_r is NULL, names are not compressed. If _l_a_s_t_d_n_p_t_r is 358 NULL, the list of labels is not updated. 359 360 The ddnn__eexxppaanndd() entry expands the compressed domain name _c_o_m_p___d_n to a 361 full domain name. The compressed name is contained in a query or reply 362 message; _m_s_g is a pointer to the beginning of the message. _e_o_m_o_r_i_g is a 363 pointer to the first location after the message. The uncompressed name 364 is placed in the buffer indicated by _e_x_p___d_n which is of size _l_e_n_g_t_h. The 365 size of compressed name is returned or -1 if there was an error. 366 367 The variables _s_t_a_t_p_-_>_r_e_s___h___e_r_r_n_o / ___r_e_s_._r_e_s___h___e_r_r_n_o and external variable 368 _h___e_r_r_n_o is set whenever an error occurs during resolver operation. The 369 following definitions are given in _<_n_e_t_d_b_._h_>: 370 371 #define NETDB_INTERNAL -1 /* see errno */ 372 #define NETDB_SUCCESS 0 /* no problem */ 373 #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ 374 #define TRY_AGAIN 2 /* Non-Authoritative not found, or SERVFAIL */ 375 #define NO_RECOVERY 3 /* Non-Recoverable: FORMERR, REFUSED, NOTIMP */ 376 #define NO_DATA 4 /* Valid name, no data for requested type */ 377 378 The hheerrrroorr() function writes a message to the diagnostic output consist- 379 ing of the string parameter _s, the constant string ": ", and a message 380 corresponding to the value of _h___e_r_r_n_o. 381 382 The hhssttrreerrrroorr() function returns a string which is the message text cor- 383 responding to the value of the _e_r_r parameter. 384 385FFIILLEESS 386 /etc/resolv.conf See resolver(5). 387 388SSEEEE AALLSSOO 389 gethostbyname(3), hostname(7), resolver(5); RFC1032, RFC1033, RFC1034, 390 RFC1035, RFC974; SMM:11, ``Name Server Operations Guide for BIND'' 391 3924th Berkeley Distribution July 4, 2000 4th Berkeley Distribution 393