diff options
Diffstat (limited to 'src/lib/libc/net/getrrsetbyname.3')
| -rw-r--r-- | src/lib/libc/net/getrrsetbyname.3 | 166 |
1 files changed, 166 insertions, 0 deletions
diff --git a/src/lib/libc/net/getrrsetbyname.3 b/src/lib/libc/net/getrrsetbyname.3 new file mode 100644 index 0000000000..50cadfd372 --- /dev/null +++ b/src/lib/libc/net/getrrsetbyname.3 | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | .\" $OpenBSD: getrrsetbyname.3,v 1.7 2002/06/09 05:03:59 deraadt Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (C) 2000, 2001 Internet Software Consortium. | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM | ||
| 10 | .\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL | ||
| 11 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL | ||
| 12 | .\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
| 13 | .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING | ||
| 14 | .\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, | ||
| 15 | .\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION | ||
| 16 | .\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | .\" | ||
| 18 | .Dd Oct 18, 2000 | ||
| 19 | .Dt GETRRSETBYNAME 3 | ||
| 20 | .Os | ||
| 21 | .Sh NAME | ||
| 22 | .Nm getrrsetbyname | ||
| 23 | .Nd retrieve DNS records | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .Fd #include <netdb.h> | ||
| 26 | .Ft int | ||
| 27 | .Fn getrrsetbyname "const char *hostname" "unsigned int rdclass" \ | ||
| 28 | "unsigned int rdtype" "unsigned int flags" "struct rrsetinfo **res" | ||
| 29 | .Ft int | ||
| 30 | .Fn freerrset "struct rrsetinfo **rrset" | ||
| 31 | .Sh DESCRIPTION | ||
| 32 | .Fn getrrsetbyname | ||
| 33 | gets a set of resource records associated with a | ||
| 34 | .Fa hostname , | ||
| 35 | .Fa class | ||
| 36 | and | ||
| 37 | .Fa type . | ||
| 38 | .Fa hostname | ||
| 39 | is a pointer a to null-terminated string. | ||
| 40 | The | ||
| 41 | .Fa flags | ||
| 42 | field is currently unused and must be zero. | ||
| 43 | .Pp | ||
| 44 | After a successful call to | ||
| 45 | .Fn getrrsetbyname , | ||
| 46 | .Fa *res | ||
| 47 | is a pointer to an | ||
| 48 | .Li rrsetinfo | ||
| 49 | structure, containing a list of one or more | ||
| 50 | .Li rdatainfo | ||
| 51 | structures containing resource records and potentially another list of | ||
| 52 | .Li rdatainfo | ||
| 53 | structures containing SIG resource records associated with those records. | ||
| 54 | The members | ||
| 55 | .Li rri_rdclass | ||
| 56 | and | ||
| 57 | .Li rri_rdtype | ||
| 58 | are copied from the parameters. | ||
| 59 | .Li rri_ttl | ||
| 60 | and | ||
| 61 | .Li rri_name | ||
| 62 | are properties of the obtained rrset. | ||
| 63 | The resource records contained in | ||
| 64 | .Li rri_rdatas | ||
| 65 | and | ||
| 66 | .Li rri_sigs | ||
| 67 | are in uncompressed DNS wire format. | ||
| 68 | Properties of the rdataset are represented in the | ||
| 69 | .Li rri_flags | ||
| 70 | bitfield. | ||
| 71 | If the | ||
| 72 | .Dv RRSET_VALIDATED | ||
| 73 | bit is set, the data has been DNSSEC | ||
| 74 | validated and the signatures verified. | ||
| 75 | .Pp | ||
| 76 | The following structures are used: | ||
| 77 | .Bd -literal -offset | ||
| 78 | struct rdatainfo { | ||
| 79 | unsigned int rdi_length; /* length of data */ | ||
| 80 | unsigned char *rdi_data; /* record data */ | ||
| 81 | }; | ||
| 82 | |||
| 83 | struct rrsetinfo { | ||
| 84 | unsigned int rri_flags; /* RRSET_VALIDATED ... */ | ||
| 85 | unsigned int rri_rdclass; /* class number */ | ||
| 86 | unsigned int rri_rdtype; /* RR type number */ | ||
| 87 | unsigned int rri_ttl; /* time to live */ | ||
| 88 | unsigned int rri_nrdatas; /* size of rdatas array */ | ||
| 89 | unsigned int rri_nsigs; /* size of sigs array */ | ||
| 90 | char *rri_name; /* canonical name */ | ||
| 91 | struct rdatainfo *rri_rdatas; /* individual records */ | ||
| 92 | struct rdatainfo *rri_sigs; /* individual signatures */ | ||
| 93 | }; | ||
| 94 | .Ed | ||
| 95 | .Pp | ||
| 96 | All of the information returned by | ||
| 97 | .Fn getrrsetbyname | ||
| 98 | is dynamically allocated: the | ||
| 99 | .Li rrsetinfo | ||
| 100 | and | ||
| 101 | .Li rdatainfo | ||
| 102 | structures, | ||
| 103 | and the canonical host name strings pointed to by the | ||
| 104 | .Li rrsetinfo | ||
| 105 | u lib/libc/sys/lseek.2 | ||
| 106 | structure. | ||
| 107 | Memory allocated for the dynamically allocated structures created by | ||
| 108 | a successful call to | ||
| 109 | .Fn getrrsetbyname | ||
| 110 | is released by | ||
| 111 | .Fn freerrset . | ||
| 112 | .Li rrset | ||
| 113 | is a pointer to a | ||
| 114 | .Li struct rrset | ||
| 115 | created by a call to | ||
| 116 | .Fn getrrsetbyname . | ||
| 117 | .Pp | ||
| 118 | If the EDNS0 option is activated in | ||
| 119 | .Xr resolv.conf 3 , | ||
| 120 | .Fn getrrsetbyname | ||
| 121 | will request DNSSEC authentication using the EDNS0 DNSSEC OK (DO) bit. | ||
| 122 | .Sh "RETURN VALUES" | ||
| 123 | .Fn getrrsetbyname | ||
| 124 | returns zero on success, and one of the following error | ||
| 125 | codes if an error occurred: | ||
| 126 | .Pp | ||
| 127 | .Bl -tag -width ERRSET_NOMEMORY -compact | ||
| 128 | .It Dv ERRSET_NONAME | ||
| 129 | the name does not exist | ||
| 130 | .It Dv ERRSET_NODATA | ||
| 131 | the name exists, but does not have data of the desired type | ||
| 132 | .It Dv ERRSET_NOMEMORY | ||
| 133 | memory could not be allocated | ||
| 134 | .It Dv ERRSET_INVAL | ||
| 135 | a parameter is invalid | ||
| 136 | .It Dv ERRSET_FAIL | ||
| 137 | other failure | ||
| 138 | .El | ||
| 139 | .Sh SEE ALSO | ||
| 140 | .Xr resolver 3 , | ||
| 141 | .Xr resolv.conf 5 , | ||
| 142 | .Xr named 8 | ||
| 143 | .Sh AUTHORS | ||
| 144 | Jakob Schlyter | ||
| 145 | .Aq jakob@openbsd.org | ||
| 146 | .Sh HISTORY | ||
| 147 | .Fn getrrsetbyname | ||
| 148 | first appeared in | ||
| 149 | .Ox 3.0 . | ||
| 150 | The API first appeared in ISC BIND version 9. | ||
| 151 | .Sh BUGS | ||
| 152 | The data in | ||
| 153 | .Li *rdi_data | ||
| 154 | should be returned in uncompressed wire format. | ||
| 155 | Currently, the data is in compressed format and the caller can't | ||
| 156 | uncompress since it doesn't have the full message. | ||
| 157 | .Sh CAVEATS | ||
| 158 | The | ||
| 159 | .Dv RRSET_VALIDATED | ||
| 160 | flag in | ||
| 161 | .Li rri_flags | ||
| 162 | is set if the AD (autenticated data) bit in the DNS answer is | ||
| 163 | set. This flag | ||
| 164 | .Em should not | ||
| 165 | be trusted unless the transport between the nameserver and the resolver | ||
| 166 | is secure (e.g. IPsec, trusted network, loopback communication). | ||
