| 1 |
.\" $Id: hesiod.3,v 1.12 2000-01-05 16:28:51 ghudson Exp $ |
| 2 |
.\" |
| 3 |
.\" Copyright 1988, 1996, 2000 by the Massachusetts Institute of Technology. |
| 4 |
.\" |
| 5 |
.\" Redistribution and use in source and binary forms, with or without |
| 6 |
.\" modification, are permitted provided that the following conditions |
| 7 |
.\" are met: |
| 8 |
.\" |
| 9 |
.\" * Redistributions of source code must retain the above copyright |
| 10 |
.\" notice, this list of conditions and the following disclaimer. |
| 11 |
.\" |
| 12 |
.\" * Redistributions in binary form must reproduce the above copyright |
| 13 |
.\" notice, this list of conditions and the following disclaimer in |
| 14 |
.\" the documentation and/or other materials provided with the |
| 15 |
.\" distribution. |
| 16 |
.\" |
| 17 |
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 |
.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 |
.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 |
.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 |
.\" COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 22 |
.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 |
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 |
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 |
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 26 |
.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 |
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 28 |
.\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
.\" |
| 30 |
.TH HESIOD 3 "30 November 1996" |
| 31 |
.SH NAME |
| 32 |
hesiod, hesiod_init, hesiod_resolve, hesiod_free_list, hesiod_to_bind, hesiod_free_string, hesiod_end \- Hesiod name server interface library |
| 33 |
.SH SYNOPSIS |
| 34 |
.nf |
| 35 |
.B #include <hesiod.h> |
| 36 |
.PP |
| 37 |
.B int hesiod_init(void **\fIcontext\fP) |
| 38 |
.B char **hesiod_resolve(void *\fIcontext\fP, const char *\fIname\fP, |
| 39 |
.B const char *\fItype\fP) |
| 40 |
.B void hesiod_free_list(void *\fIcontext\fP, char **\fIlist\fP); |
| 41 |
.B char *hesiod_to_bind(void *\fIcontext\fP, const char *\fIname\fP, |
| 42 |
.B const char *\fItype\fP) |
| 43 |
.B void hesiod_free_string(void *\fIcontext\fP, char *\fIstr\fP); |
| 44 |
.B char **hesiod_parse_result(void *\fIcontext\fP, |
| 45 |
.B unsigned const char *\fIresult\fP, int \fIrlen\fP) |
| 46 |
.B void hesiod_end(void *\fIcontext\fP) |
| 47 |
.PP |
| 48 |
.B cc file.c \-lhesiod |
| 49 |
.fi |
| 50 |
.SH DESCRIPTION |
| 51 |
This family of functions allows you to perform lookups of Hesiod |
| 52 |
information, which is stored as text records in the Domain Name |
| 53 |
Service. To perform lookups, you must first initialize a |
| 54 |
.IR context , |
| 55 |
an opaque object which stores information used internally by the |
| 56 |
library between calls. |
| 57 |
.I hesiod_init |
| 58 |
initializes a context, storing a pointer to the context in the |
| 59 |
location pointed to by the |
| 60 |
.I context |
| 61 |
argument. |
| 62 |
.I hesiod_end |
| 63 |
frees the resources used by a context. |
| 64 |
.PP |
| 65 |
.I hesiod_resolve |
| 66 |
is the primary interface to the library. If successful, it returns a |
| 67 |
list of one or more strings giving the records matching |
| 68 |
.I name |
| 69 |
and |
| 70 |
.IR type . |
| 71 |
The last element of the list is followed by a NULL pointer. It is the |
| 72 |
caller's responsibility to call |
| 73 |
.I hesiod_free_list |
| 74 |
to free the resources used by the returned list. |
| 75 |
.PP |
| 76 |
.I hesiod_to_bind |
| 77 |
converts |
| 78 |
.I name |
| 79 |
and |
| 80 |
.I type |
| 81 |
into the DNS name used by |
| 82 |
.IR hesiod_resolve . |
| 83 |
It is the caller's responsibility to free the returned string using |
| 84 |
.IR hesiod_free_string . |
| 85 |
.PP |
| 86 |
.I hesiod_parse_result |
| 87 |
parses the result of a name server query into text records. It is the |
| 88 |
caller's responsibility to call |
| 89 |
.I hesiod_free_list |
| 90 |
to free the resources used by the returned list. |
| 91 |
.SH RETURN VALUES |
| 92 |
If successful, |
| 93 |
.I hesiod_init |
| 94 |
returns 0; otherwise it returns \-1 and sets |
| 95 |
.I errno |
| 96 |
to indicate the error. On failure, |
| 97 |
.I hesiod_resolve |
| 98 |
and |
| 99 |
.I hesiod_to_bind |
| 100 |
return NULL and set the global variable |
| 101 |
.I errno |
| 102 |
to indicate the error. |
| 103 |
.SH ENVIRONMENT |
| 104 |
If the environment variable |
| 105 |
.B HES_DOMAIN |
| 106 |
is set, it will override the domain in the Hesiod configuration file. |
| 107 |
If the environment variable |
| 108 |
.B HESIOD_CONFIG |
| 109 |
is set, it specifies the location of the Hesiod configuration file. |
| 110 |
.SH SEE ALSO |
| 111 |
`Hesiod - Project Athena Technical Plan -- Name Service', named(8), |
| 112 |
hesiod.conf(5) |
| 113 |
.SH ERRORS |
| 114 |
Hesiod calls may fail because of: |
| 115 |
.IP ENOMEM |
| 116 |
Insufficient memory was available to carry out the requested |
| 117 |
operation. |
| 118 |
.IP ENOEXEC |
| 119 |
.I hesiod_init |
| 120 |
failed because the Hesiod configuration file was invalid. |
| 121 |
.IP ECONNREFUSED |
| 122 |
.I hesiod_resolve |
| 123 |
failed because no name server could be contacted to answer the query. |
| 124 |
.IP EMSGSIZE |
| 125 |
.I hesiod_resolve |
| 126 |
or |
| 127 |
.I hesiod_to_bind |
| 128 |
failed because the query or response was too big to fit into the |
| 129 |
packet buffers. |
| 130 |
.IP ENOENT |
| 131 |
.I hesiod_resolve |
| 132 |
failed because the name server had no text records matching |
| 133 |
.I name |
| 134 |
and |
| 135 |
.IR type , |
| 136 |
or |
| 137 |
.I hesiod_to_bind |
| 138 |
failed because the |
| 139 |
.I name |
| 140 |
argument had a domain extension which could not be resolved with type |
| 141 |
``rhs-extension'' in the local Hesiod domain. |
| 142 |
.IP EINVAL |
| 143 |
.I hesiod_to_bind |
| 144 |
failed to convert the resulting domain name from UTF-8 to an |
| 145 |
internationalized domain name. |
| 146 |
.SH AUTHOR |
| 147 |
Steve Dyer, IBM/Project Athena |
| 148 |
.br |
| 149 |
Greg Hudson, MIT Team Athena |
| 150 |
.br |
| 151 |
Copyright 1987, 1988, 1995, 1996, 2000 by the Massachusetts Institute |
| 152 |
of Technology. |
| 153 |
.SH BUGS |
| 154 |
The strings corresponding to the |
| 155 |
.I errno |
| 156 |
values set by the Hesiod functions are not particularly indicative of |
| 157 |
what went wrong, especially for |
| 158 |
.I ENOEXEC |
| 159 |
and |
| 160 |
.IR ENOENT . |