resolver.3
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3 代码 · 共 225 行
3
225 行
.\" Copyright (c) 1985 Regents of the University of California..\" All rights reserved. The Berkeley software License Agreement.\" specifies the terms and conditions for redistribution..\".\" @(#)resolver.3 1.7 (Berkeley) 5/27/86.\".TH resolver 3.SH Nameres_mkquery, res_send, res_init, dn_comp, dn_expand \- resolver routines.SH Syntax.nf.B #include <sys/types.h>.br.B #include <netinet/in.h>.br.B #include <arpa/nameser.h>.br.B #include <resolv.h>.PP.B "res_mkquery(\fIop, dname, class, type, data, datalen, newrr, buf, buflen\fP)".br.B int \fIop\fP;.br.B char *\fIdname\fP;.br.B int \fIclass, type\fP;.br.B char *\fIdata\fP;.br.B int \fIdatalen\fP;.br.B struct rrec *\fInewrr\fP;.br.B char *\fIbuf\fP;.br.B int \fIbuflen\fP;.PP.B res_send(\fImsg, msglen, answer, anslen\fP).br.B char *\fImsg\fP;.br.B int \fImsglen\fP;.br.B char *\fIanswer\fP;.br.B int \fIanslen\fP;.PP.B res_init().PP.B dn_comp(\fIexp_dn, comp_dn, length, dnptrs, lastdnptr\fP).br.B char *\fIexp_dn, *comp_dn\fP;.br.B int \fIlength\fP;.br.B char **\fIdnptrs, **lastdnptr\fP;.PP.B dn_expand(\fImsg, eomorig, comp_dn, exp_dn, length\fP).br.B char *\fImsg, *eomorig, *comp_dn, exp_dn\fP;.br.B int \fIlength\fP;.SH DescriptionThe resolver routines are used for making,sending,.NXR "resolver routines".NXR "resolver routines" "and BIND servers"and interpreting packets to BIND servers.Global information that is used by theresolver routines is kept in the variable.PN _res .Most of the values have reasonable defaults and you need not beconcerned with them.The options are a simple bit mask and are or'ed in to enable.The options stored in.PN _res.optionsare defined in.PN /usr/include/resolv.hand are as follows:.IP RES_INIT 19True if the initial name server address and default domain name areinitialized,for example if.PN res_inithas been called..IP RES_DEBUGPrint debugging messages..IP RES_AAONLYAccept authoritative answers only..\" The.\" .B res_send.\" routine continues until it finds an authoritative answer.\" or finds an error..\" Currently this is not implemented..IP RES_USEVCUse TCP connections for queries instead of UDP..IP RES_STAYOPENThis is used with.PN RES_USEVCto keep the TCP connection open between queries.This is useful only in programs that regularly do many queries.You should normally use UDP..\" .IP RES_IGNTC.\" Unused currently (ignore truncation errors, for example,.\" do not retry with TCP)..IP RES_RECURSESet the recursion desired bit in queries.This is the default.The.PN res_sendroutine does not do iterative queries and expects the BIND serverto handle recursion..IP RES_DEFNAMESAppend the default domain name to single label queries.This is the default..PPThe following lists the routines found in.PN /usr/lib/libc.a.IP res_init 16This routine reads the initialization file to get the defaultdomain name and the Internet address of the initial hostsrunning the name server.If this line does not exist,the host running the resolver is tried..IP res_mkqueryThis routine makes a standard query message and places it in.IR buf .The.I res_mkqueryroutine returns the size of the query or \-1 if the query islarger than.IR buflen ..RS.IP opThe opcode is usually.PN QUERY ,but can be any of the query types defined in.IR nameser.h ..IP DnameThis variable is the domain name.If.I dnameconsists of a single label and the.PN RES_DEFNAMESflag is enabled,which is the default,.I dnameis appended with the current domain name.The current domain name is defined in a system file,but you can override it by using the environment variable.PN LOCALDOMAIN ..RE.\" .IP newrr.\" This routine is currently unused,.\" but is intended for making update messages..sp.IP res_sendThis routine sends a query to the BIND servers and returns an answer.It calls the.PN res_initroutine.If.PN RES_INITis not set, .PN res_sendsends the query to the local name server,and handle timeouts and retries.The length of the message is returned or\-1 if there were errors..IP dn_compThis routine compresses the domain name.I exp_dnand stores it in.IR comp_dn .The size of the compressed name is returned or \-1 if there were errors.The.I lengthis the size of the array pointed to by.IR comp_dn ..RS.IP dnptrsThis variable is a list of pointers to previously compressed namesin the current message.The first pointer points tothe beginning of the message and the list ends with.PN NULL ..IP lastdnptrThis is a pointer to the end of the array pointed to by.IR dnptrs .A side effect is to update the list of pointers forlabels inserted into the message by.I dn_compas the name is compressed.If.I dnptris NULL, the names are not compressed.If.I lastdnptris NULL, the list is not updated..RE.IP dn_expandThis routine expands the compressed domain name.PN comp_dnto a full BIND domain name.Expanded names are converted to upper case..RS.IP msgThis variable is a pointer to the beginning of the message..IP exp_dnThis variable is a pointer to a buffer of size.I lengthfor the result.The size of the compressed name is returned or \-1 if there was an error..RE.SH Files.PN /etc/resolv.conf.br.PN /usr/include/resolv.h.br.PN /usr/include/arpa/nameser.h.SH See Alsonamed(8), resolv.conf(5).br.I Guide to the BIND/Hesiod Service
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?