URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [libc/] [resolver.3] - Rev 214
Go to most recent revision | Compare with Previous | Blame | View Log
.\" Copyright (c) 1985, 1991, 1993.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)resolver.3 8.1 (Berkeley) 6/4/93.\" $Id: resolver.3,v 1.2 2001-09-27 12:01:53 chris Exp $.\".Dd June 4, 1993.Dt RESOLVER 3.Os BSD 4.3.Sh NAME.Nm res_query ,.Nm res_search ,.Nm res_mkquery ,.Nm res_send ,.Nm res_init ,.Nm dn_comp ,.Nm dn_expand.Nd resolver routines.Sh SYNOPSIS.Fd #include <sys/types.h>.Fd #include <netinet/in.h>.Fd #include <arpa/nameser.h>.Fd #include <resolv.h>.Ft int.Fo res_query.Fa "const char *dname".Fa "int class".Fa "int type".Fa "u_char *answer".Fa "int anslen".Fc.Ft int.Fo res_search.Fa "const char *dname".Fa "int class".Fa "int type".Fa "u_char *answer".Fa "int anslen".Fc.Ft int.Fo res_mkquery.Fa "int op".Fa "const char *dname".Fa "int class".Fa "int type".Fa "const u_char *data".Fa "int datalen".Fa "const u_char *newrr_in".Fa "u_char *buf".Fa "int buflen".Fc.Ft int.Fo res_send.Fa "const u_char *msg".Fa "int msglen".Fa "u_char *answer".Fa "int anslen".Fc.Ft int.Fn res_init.Fo dn_comp.Fa "const char *exp_dn".Fa "u_char *comp_dn".Fa "int length".Fa "u_char **dnptrs".Fa "u_char **lastdnptr".Fc.Ft int.Fo dn_expand.Fa "const u_char *msg".Fa "const u_char *eomorig".Fa "const u_char *comp_dn".Fa "char *exp_dn".Fa "int length".Fc.Sh DESCRIPTIONThese routines are used for making, sending and interpretingquery and reply messages with Internet domain name servers..PpGlobal configuration and state information that is used by theresolver routines is kept in the structure.Em _res .Most of the values have reasonable defaults and can be ignored.Optionsstored in.Em _res.optionsare defined in.Pa resolv.hand are as follows.Options are stored as a simple bit mask containing the bitwise ``or''of the options enabled..Bl -tag -width RES_DEFNAMES.It Dv RES_INITTrue if the initial name server address and default domain name areinitialized (i.e.,.Fn res_inithas been called)..It Dv RES_DEBUGPrint debugging messages..It Dv RES_AAONLYAccept authoritative answers only.With this option,.Fn res_sendshould continue until it finds an authoritative answer or finds an error.Currently this is not implemented..It Dv RES_USEVCUse.Tn TCPconnections for queries instead of.Tn UDPdatagrams..It Dv RES_STAYOPENUsed with.Dv RES_USEVCto keep the.Tn TCPconnection open betweenqueries.This is useful only in programs that regularly do many queries..Tn UDPshould be the normal mode used..It Dv RES_IGNTCUnused currently (ignore truncation errors, i.e., don't retry with.Tn TCP ) ..It Dv RES_RECURSESet the recursion-desired bit in queries.This is the default..Pf ( Fn res_senddoes not do iterative queries and expects the name serverto handle recursion.).It Dv RES_DEFNAMESIf set,.Fn res_searchwill append the default domain name to single-component names(those that do not contain a dot).This option is enabled by default..It Dv RES_DNSRCHIf this option is set,.Fn res_searchwill search for host names in the current domain and in parent domains; see.Xr hostname 7 .This is used by the standard host lookup routine.Xr gethostbyname 3 .This option is enabled by default..It Dv RES_NOALIASESThis option turns off the user level aliasing feature controlled by the.Dq Ev HOSTALIASESenvironment variable. Network daemons should set this option..El.PpThe.Fn res_initroutinereads the configuration file (if any; see.Xr resolver 5 )to get the default domain name,search list andthe Internet address of the local name server(s).If no server is configured, the host runningthe resolver is tried.The current domain name is defined by the hostnameif not specified in the configuration file;it can be overridden by the environment variable.Ev LOCALDOMAIN .This environment variable may contain several blank-separatedtokens if you wish to override the.Em "search list"on a per-process basis. This is similar to the.Em searchcommand in the configuration file.Another environment variable (.Dq Ev RES_OPTIONScan be set tooverride certain internal resolver options which are otherwiseset by changing fields in the.Em _resstructure or are inherited from the configuration file's.Em optionscommand. The syntax of the.Dq Ev RES_OPTIONSenvironment variable is explained in.Xr resolver 5 .Initialization normally occurs on the first callto one of the following routines..PpThe.Fn res_queryfunction provides an interface to the server query mechanism.It constructs a query, sends it to the local server,awaits a response, and makes preliminary checks on the reply.The query requests information of the specified.Fa typeand.Fa classfor the specified fully-qualified domain name.Fa dname .The reply message is left in the.Fa answerbuffer with length.Fa anslensupplied by the caller..PpThe.Fn res_searchroutine makes a query and awaits a response like.Fn res_query ,but in addition, it implements the default and search rulescontrolled by the.Dv RES_DEFNAMESand.Dv RES_DNSRCHoptions.It returns the first successful reply..PpThe remaining routines are lower-level routines used by.Fn res_query .The.Fn res_mkqueryfunctionconstructs a standard query message and places it in.Fa buf .It returns the size of the query, or \-1 if the query islarger than.Fa buflen .The query type.Fa opis usually.Dv QUERY ,but can be any of the query types defined in.Aq Pa arpa/nameser.h .The domain name for the query is given by.Fa dname ..Fa Newrris currently unused but is intended for making update messages..PpThe.Fn res_sendroutinesends a pre-formatted query and returns an answer.It will call.Fn res_initif.Dv RES_INITis not set, send the query to the local name server, andhandle timeouts and retries.The length of the reply message is returned, or\-1 if there were errors..PpThe.Fn dn_compfunctioncompresses the domain name.Fa exp_dnand stores it in.Fa comp_dn .The size of the compressed name is returned or \-1 if there were errors.The size of the array pointed to by.Fa comp_dnis given by.Fa length .The compression usesan array of pointers.Fa dnptrsto previously-compressed names in the current message.The first pointer points toto the beginning of the message and the list ends with.Dv NULL .The limit to the array is specified by.Fa lastdnptr .A side effect of.Fn dn_compis to update the list of pointers forlabels inserted into the messageas the name is compressed.If.Em dnptris.Dv NULL, names are not compressed.If.Fa lastdnptris.Dv NULL ,the list of labels is not updated..PpThe.Fn dn_expandentryexpands the compressed domain name.Fa comp_dnto a full domain nameThe compressed name is contained in a query or reply message;.Fa msgis a pointer to the beginning of the message.The uncompressed name is placed in the buffer indicated by.Fa exp_dnwhich is of size.Fa length .The size of compressed name is returned or \-1 if there was an error..Sh FILES.Bl -tag -width Pa/etc/resolv.confThe configuration filesee.Xr resolver 5 ..El.Sh SEE ALSO.Xr gethostbyname 3 ,.Xr resolver 5 ,.Xr hostname 7 ,.Xr named 8.Pp.%T RFC1032 ,.%T RFC1033 ,.%T RFC1034 ,.%T RFC1035 ,.%T RFC974.Rs.%T "Name Server Operations Guide for BIND".Re.Sh HISTORYThe.Nmfunction appeared in.Bx 4.3 .
Go to most recent revision | Compare with Previous | Blame | View Log
