| 1 |
.\" $Id: hesiod_getservbyname.3,v 1.1 1996-12-08 21:38:45 ghudson Exp $ |
| 2 |
.\" |
| 3 |
.\" Copyright 1996 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_getservbyname, hesiod_free_servent \- Hesiod functions for retrieving service information |
| 33 |
.SH SYNOPSIS |
| 34 |
.nf |
| 35 |
.B #include <hesiod.h> |
| 36 |
.PP |
| 37 |
.B struct servent *hesiod_getservbyname(void *\fIcontext\fP, |
| 38 |
.B const char *\fIname\fP, const char *\fIproto\fP) |
| 39 |
.B void hesiod_free_servent(void *\fIcontext\fP, struct servent *\fIserv\fP) |
| 40 |
.PP |
| 41 |
.B cc file.c -lhesiod |
| 42 |
.fi |
| 43 |
.SH DESCRIPTION |
| 44 |
This family of functions allows you to retrieve service to port |
| 45 |
mappings using Hesiod. To perform lookups, you need an initialized |
| 46 |
Hesiod context; see hesiod(3) for details. Information is returned in |
| 47 |
the same format as by |
| 48 |
.IR getservbyname . |
| 49 |
It is the caller's responsibility to call |
| 50 |
.I hesiod_free_servent |
| 51 |
with the returned service entry to free the resources used by the |
| 52 |
service entry. |
| 53 |
.PP |
| 54 |
Hesiod queries for service information are made using the ``service'' |
| 55 |
Hesiod type, using the service name as the Hesiod name. The |
| 56 |
corresponding records should be space-separated lists of strings |
| 57 |
giving the service name, protocol, port number (in decimal), and zero |
| 58 |
or more aliases for the service. There may be multiple records per |
| 59 |
service name; |
| 60 |
.I hesiod_getservbyname |
| 61 |
will pick the first one whose protocol matches |
| 62 |
.IR proto . |
| 63 |
.SH RETURN VALUES |
| 64 |
On failure, |
| 65 |
.I hesiod_getservbyname |
| 66 |
returns NULL and sets the global variable |
| 67 |
.I errno |
| 68 |
to indicate the error. |
| 69 |
.SH ERRORS |
| 70 |
.I hesiod_getservbyname |
| 71 |
may fail for any of the reasons the routine |
| 72 |
.I hesiod_resolve |
| 73 |
may fail. |
| 74 |
.SH SEE ALSO |
| 75 |
hesiod(3) |