📄 getrrsetbyname.3
字号:
.\" $OpenBSD: getrrsetbyname.3,v 1.4 2001/08/08 16:28:43 jakob Exp $.\".\" Copyright (C) 2000, 2001 Internet Software Consortium..\".\" Permission to use, copy, modify, and distribute this software for any.\" purpose with or without fee is hereby granted, provided that the above.\" copyright notice and this permission notice appear in all copies..\".\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE..\".Dd Oct 18, 2000.Dt GETRRSETBYNAME 3.Os.Sh NAME.Nm getrrsetbyname.Nd retrieve DNS records.Sh SYNOPSIS.Fd #include <netdb.h>.Ft int.Fn getrrsetbyname "const char *hostname" "unsigned int rdclass" \"unsigned int rdtype" "unsigned int flags" "struct rrsetinfo **res".Ft int.Fn freerrset "struct rrsetinfo **rrset".Sh DESCRIPTION.Fn getrrsetbynamegets a set of resource records associated with a.Fa hostname ,.Fa classand.Fa type ..Fa hostnameis a pointer a to null-terminated string.The.Fa flagsfield is currently unused and must be zero..PpAfter a successful call to.Fn getrrsetbyname ,.Fa *resis a pointer to an.Li rrsetinfostructure, containing a list of one or more.Li rdatainfostructures containing resource records and potentially another list of.Li rdatainfostructures containing SIG resource records associated with those records.The members.Li rri_rdclassand.Li rri_rdtypeare copied from the parameters..Li rri_ttland.Li rri_nameare properties of the obtained rrset.The resource records contained in.Li rri_rdatasand.Li rri_sigsare in uncompressed DNS wire format.Properties of the rdataset are represented in the.Li rri_flagsbitfield. If the.Dv RRSET_VALIDATEDbit is set, the data has been DNSSECvalidated and the signatures verified. .PpThe following structures are used:.Bd -literal -offsetstruct rdatainfo { unsigned int rdi_length; /* length of data */ unsigned char *rdi_data; /* record data */};struct rrsetinfo { unsigned int rri_flags; /* RRSET_VALIDATED ... */ unsigned int rri_rdclass; /* class number */ unsigned int rri_rdtype; /* RR type number */ unsigned int rri_ttl; /* time to live */ unsigned int rri_nrdatas; /* size of rdatas array */ unsigned int rri_nsigs; /* size of sigs array */ char *rri_name; /* canonical name */ struct rdatainfo *rri_rdatas; /* individual records */ struct rdatainfo *rri_sigs; /* individual signatures */};.Ed.PpAll of the information returned by.Fn getrrsetbynameis dynamically allocated: the.Li rrsetinfoand.Li rdatainfostructures,and the canonical host name strings pointed to by the.Li rrsetinfostructure.Memory allocated for the dynamically allocated structures created bya successful call to.Fn getrrsetbynameis released by.Fn freerrset ..Li rrsetis a pointer to a.Li struct rrsetcreated by a call to.Fn getrrsetbyname ..PpIf the EDNS0 option is activated in.Xr resolv.conf 3 ,.Fn getrrsetbynamewill request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit..Sh "RETURN VALUES".Fn getrrsetbynamereturns zero on success, and one of the following errorcodes if an error occurred:.Pp.Bl -tag -width ERRSET_NOMEMORY -compact.It Dv ERRSET_NONAMEthe name does not exist.It Dv ERRSET_NODATAthe name exists, but does not have data of the desired type.It Dv ERRSET_NOMEMORYmemory could not be allocated.It Dv ERRSET_INVALa parameter is invalid.It Dv ERRSET_FAILother failure.El.Sh SEE ALSO.Xr resolver 3 ,.Xr resolv.conf 5 ,.Xr named 8.Sh AUTHORSJakob Schlyter.Aq jakob@openbsd.org.Sh HISTORY.Fn getrrsetbynamefirst appeared in.Ox 3.0 .The API first appeared in ISC BIND version 9..Sh BUGSThe data in.Li *rdi_datashould be returned in uncompressed wire format.Currently, the data is in compressed format and the caller can'tuncompress since it doesn't have the full message..Sh CAVEATSThe.Dv RRSET_VALIDATEDflag in.Li rri_flagsis set if the AD (autenticated data) bit in the DNS answer isset. This flag.Em should notbe trusted unless the transport between the nameserver and the resolveris secure (e.g. IPsec, trusted network, loopback communication).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -