1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
|
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu)
.\" Modified 2004-10-31 by aeb
.\"
.\" Japanese Version Copyright (c) 1998 Shinji Orito all rights reserved.
.\" Translated Mon May 25 21:27:03 JST 1998
.\" by Shinji Orito <shinji@os.gulf.or.jp>
.\" Updated & Modified Thu Feb 17 03:58:45 JST 2005
.\" by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.\"WORD: resolver 쥾 ()
.\"WORD: override С饤
.\"WORD: call ƤӽФƤӽФ
.\"WORD: fully qualified domain name ɥᥤ̾(FQDN)
.\"WORD: type
.\"WORD: class 饹
.\"WORD: query 䤤碌䤤碌
.\"WORD: buffer Хåե
.\"WORD: lower-level routines ̥롼
.\"WORD: limit of the array ϰ
.\"WORD: state information ֤ξ
.\"WORD: bitwise ``or'' ӥåñ̤
.\"WORD: True
.\"WORD: authoritative դ줿
.\"WORD: recursion desired bit Ƶӥå
.\"WORD: single component names ʬʤ̾
.\"
.TH RESOLVER 3 2008-11-07 "GNU" "Linux Programmer's Manual"
.SH ̾
res_init, res_query, res_search, res_querydomain, res_mkquery, res_send, dn_comp, dn_expand \- 쥾С롼
.SH
.nf
.B #include <netinet/in.h>
.B #include <arpa/nameser.h>
.B #include <resolv.h>
.B extern struct state _res;
.sp
.B int res_init(void);
.sp
.BI "int res_query(const char *" dname ", int " class ", int " type ,
.RS
.BI "unsigned char *" answer ", int " anslen );
.RE
.sp
.BI "int res_search(const char *" dname ", int " class ", int " type ,
.RS
.BI "unsigned char *" answer ", int " anslen );
.RE
.sp
.BI "int res_querydomain(const char *" name ", const char *" domain ,
.RS
.BI "int " class ", int " type ", unsigned char *" answer ,
.BI "int " anslen );
.RE
.sp
.BI "int res_mkquery(int " op ", const char *" dname ", int " class ,
.RS
.BI "int " type ", char *" data ", int " datalen ", struct rrec *" newrr ,
.BI "char *" buf ", int " buflen );
.RE
.sp
.BI "int res_send(const char *" msg ", int " msglen ", char *" answer ,
.RS
.BI "int " anslen );
.RE
.sp
.BI "int dn_comp(unsigned char *" exp_dn ", unsigned char *" comp_dn ,
.RS
.BI "int " length ", unsigned char **" dnptrs ", unsigned char *" exp_dn ,
.BI "unsigned char **" lastdnptr );
.RE
.sp
.BI "int dn_expand(unsigned char *" msg ", unsigned char *" eomorig ,
.RS
.BI "unsigned char *" comp_dn ", char *" exp_dn ,
.BI "int " length );
.RE
.fi
.sp
\fI\-lresolv\fP ǥ롣
.SH
δؿϥͥåȤΥɥᥤ͡ॵС䤤碌
α᤹롣
.PP
.BR res_init ()
ؿϡǥեȤΥɥᥤ̾硢͡ॵС
ɥ쥹뤿ե (resolv.conf(5) ) ɤࡣ
⤷СƤʤХۥȤ
ɥᥤƤʤХۥȤդ줿ɥᥤѤ롣
Ķѿ
.B LOCALDOMAIN
ǥС饤ɤǤ롣
.BR res_init ()
ϡҤؿΤɤ줫ǽ˸ƤӽФ줿δؿ
¹Ԥ롣
.PP
.BR res_query ()
ؿϡꤵ줿 \fItype\fP \fIclass\fP
ɥᥤ̾ (FQDN) \fIname\fP ͡ॵС䤤碌롣
ϡƤӽФ¦ˤäѰդĹ \fIanslen\fP \fIanswer\fP
Хåե˻Ĥ롣
.PP
.BR res_search ()
ؿϡ䤤碌Ԥ
.BR res_query ()
Ʊͤα
ԤĤ˥ǥեȤƤ
.B RES_DEFNAMES
.B RES_DNSRCH
ˤäƵꤵ븡롼ŬѤ롣
( \fI_res\fP ץ)
.PP
.BR res_querydomain ()
ؿ \fIname\fP \fIdomain\fP η
.BR res_query ()
Ѥ䤤碌Ԥ
.PP
δؿϡ
.BR res_query ()
ǻȤ벼̥롼Ǥ롣
.PP
.BR res_mkquery ()
ؿϡɥᥤ̾ \fIdname\fP ΰ٤ˡĹ \fIbuflen\fP
\fIbuf\fP 䤤碌å롣
䤤碌η \fIop\fP ̾
.B QUERY
\fI<arpa/nameser.h>\fP 줿ΤɤǤɤ
\fInewrr\fP ϸѤƤʤ
.PP
.BR res_send ()
ؿϡĹ \fImsglen\fP \fImsg\fP ˷줿
䤤碌\fIanswer\fP Ĺ \fIanslen\fP β֤
ޤƤӽФƤʤ
.BR res_init ()
ƤӽФ
.PP
.BR dn_comp ()
ؿϥɥᥤ̾ \fIexp_dn\fP ̤ơĹ \fIlength\fP
ΥХåե \fIcomp_dn\fP ¸롣
̤ˤϥݥ \fIdnptrs\fP Ѥ롣
ΥݥϡߤΥåˤ˰̤줿̾ؤ
ǽΥݥϥåƬؤΥꥹȤ NULL ǽ롣
ϰϤ \fIlastdnptr\fP Ƿ롣
\fIdnptr\fP NULL ʤХɥᥤ̾ϰ̤ʤ
\fIlastdnptr\fP NULL ʤСΥ٥ΥꥹȤϥåץǡȤʤ
.PP
.BR dn_expand ()
ؿϡ̤줿ɥᥤ̾ \fIcomp_dn\fP 饵
\fIlength\fP \fIexp_dn\fP Хåեʥɥᥤ̾Ÿ롣
ΰ̤줿̾ϡ䤤碌ޤϱå˴ޤޤƤơ
\fImsg\fP åƬؤ
.PP
쥾С롼ϡ\fI<resolv.h>\fP 줿 \fI_res\fP ¤Τ
ޤޤƤŪȾ֤ξѤ롣
̾桼Ǥܤ \fI_res.options\fP Ǥ롣
ιܤϰʲΥץΥӥåñ̤¤ˤǤ롣
.TP
.B RES_INIT
.BR res_init ()
ƤӽФƤп
.TP
.B RES_DEBUG
ǥХååϤ롣
.TP
.B RES_AAONLY
դ줿 (authoritative) Τ롣
.BR res_send ()
ϡǽŪ˸դ줿뤫顼֤
ޤ³Ԥ롣
[Ƥʤ]
.TP
.B RES_USEVC
䤤碌 UDP ǡǤϤʤ TCP ³Ѥ롣
.TP
.B RES_PRIMARY
ץ饤ޥꡦɥᥤ͡ॵСΤ䤤碌롣
.TP
.B RES_IGNTC
ڤͤᥨ顼 (truncation error) ̵뤹롣TCP ǥȥ饤ʤ
[Ƥʤ]
.TP
.B RES_RECURSE
Ƶ (recursion desired) ӥåȤ䤤碌ꤹ롣
Ƶ
.BR res_send ()
ǤϤʤɥᥤ͡ॵСˤäƹԤ롣
[ǥեȤͭ]
.TP
.B RES_DEFNAMES
ꤵƤС
.BR res_search ()
ϥǥեȤΥɥᥤ̾ʬ
Τߤʤ̾ʤɥåȤޤޤʤ̾դä롣
[ǥեȤͭ]
.TP
.B RES_STAYOPEN
䤤碌 TCP ³ݤĤ
.B RES_USEVC
ȶѤ롣
.TP
.B RES_DNSRCH
ꤵƤС
.BR res_search ()
ϸߤΥɥᥤӿƥɥᥤ
ۥ̾õΥץ
.BR gethostbyname (3)
Ѥ롣
[ǥեȤͭ]
.SH ֤
.BR res_init ()
ؿ 0 顼ȯ \-1 ֤
.PP
.BR res_query (),
.BR res_search (),
.BR res_querydomain (),
.BR res_mkquery (),
.BR res_send ()
ؿϱĹ֤
ޤ顼ȯ \-1 ֤
.PP
.BR dn_comp ()
.BR dn_expand ()
ؿϰ̤줿ɥᥤ̾Ĺ֤
ޤ顼ȯ \-1 ֤
.SH ե
.nf
/etc/resolv.conf 쥾ե
/etc/host.conf 쥾ե
.fi
.SH
4.3BSD.
.SH Ϣ
.BR gethostbyname (3),
.BR resolv.conf (5),
.BR resolver (5),
.BR hostname (7),
.BR named (8)
|