NetBSD/lib/libc/net/hesiod.3

151 lines
4.1 KiB
Groff
Raw Normal View History

2001-09-16 19:53:03 +04:00
.\" $NetBSD: hesiod.3,v 1.2 2001/09/16 15:53:03 wiz Exp $
1999-01-25 06:43:04 +03:00
.\"
.\" from: #Id: hesiod.3,v 1.9.2.1 1997/01/03 21:02:23 ghudson Exp #
.\"
.\" Copyright 1988, 1996 by the Massachusetts Institute of Technology.
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
2001-09-16 19:53:03 +04:00
.Dd September 16, 2001
.Dt HESIOD 3
.Sh NAME
.Nm hesiod ,
.Nm hesiod_init ,
.Nm hesiod_resolve ,
.Nm hesiod_free_list ,
.Nm hesiod_to_bind ,
.Nm hesiod_end
.Nd Hesiod name server interface library
.Sh LIBRARY
.Lb libhesiod
.Sh SYNOPSIS
.Fd #include <hesiod.h>
.Ft int
.Fn hesiod_init "void **context"
.Ft char
.Fn **hesiod_resolve "void *context" "const char *name" "const char *type"
.Ft void
.Fn hesiod_free_list "void *context" "char **list"
.Ft char
.Fn *hesiod_to_bind "void *context" "const char *name" "const char *type"
.Ft void
.Fn hesiod_end "void *context"
.Sh DESCRIPTION
1999-01-25 06:43:04 +03:00
This family of functions allows you to perform lookups of Hesiod
information, which is stored as text records in the Domain Name
Service. To perform lookups, you must first initialize a
2001-09-16 19:53:03 +04:00
.Fa context ,
1999-01-25 06:43:04 +03:00
an opaque object which stores information used internally by the
library between calls.
2001-09-16 19:53:03 +04:00
.Fn hesiod_init
1999-01-25 06:43:04 +03:00
initializes a context, storing a pointer to the context in the
location pointed to by the
2001-09-16 19:53:03 +04:00
.Fa context
1999-01-25 06:43:04 +03:00
argument.
2001-09-16 19:53:03 +04:00
.Fn hesiod_end
1999-01-25 06:43:04 +03:00
frees the resources used by a context.
2001-09-16 19:53:03 +04:00
.Pp
.Fn hesiod_resolve
1999-01-25 06:43:04 +03:00
is the primary interface to the library. If successful, it returns a
list of one or more strings giving the records matching
2001-09-16 19:53:03 +04:00
.Fa name
1999-01-25 06:43:04 +03:00
and
2001-09-16 19:53:03 +04:00
.Fa type .
The last element of the list is followed by a
.Dv NULL
pointer. It is the caller's responsibility to call
.Fn hesiod_free_list
1999-01-25 06:43:04 +03:00
to free the resources used by the returned list.
2001-09-16 19:53:03 +04:00
.Pp
.Fn hesiod_to_bind
1999-01-25 06:43:04 +03:00
converts
2001-09-16 19:53:03 +04:00
.Fa name
1999-01-25 06:43:04 +03:00
and
2001-09-16 19:53:03 +04:00
.Fa type
1999-01-25 06:43:04 +03:00
into the DNS name used by
2001-09-16 19:53:03 +04:00
.Fn hesiod_resolve .
1999-01-25 06:43:04 +03:00
It is the caller's responsibility to free the returned string using
2001-09-16 19:53:03 +04:00
.Xr free 3 .
.Sh RETURN VALUES
1999-01-25 06:43:04 +03:00
If successful,
2001-09-16 19:53:03 +04:00
.Fn hesiod_init
1999-01-25 06:43:04 +03:00
returns 0; otherwise it returns \-1 and sets
2001-09-16 19:53:03 +04:00
.Va errno
1999-01-25 06:43:04 +03:00
to indicate the error. On failure,
2001-09-16 19:53:03 +04:00
.Fn hesiod_resolve
1999-01-25 06:43:04 +03:00
and
2001-09-16 19:53:03 +04:00
.Fn hesiod_to_bind
return
.Dv NULL
and set the global variable
.Va errno
1999-01-25 06:43:04 +03:00
to indicate the error.
2001-09-16 19:53:03 +04:00
.Sh ENVIRONMENT
1999-01-25 06:43:04 +03:00
If the environment variable
2001-09-16 19:53:03 +04:00
.Ev HES_DOMAIN
1999-01-25 06:43:04 +03:00
is set, it will override the domain in the Hesiod configuration file.
If the environment variable
2001-09-16 19:53:03 +04:00
.Ev HESIOD_CONFIG
1999-01-25 06:43:04 +03:00
is set, it specifies the location of the Hesiod configuration file.
2001-09-16 19:53:03 +04:00
.Sh ERRORS
1999-01-25 06:43:04 +03:00
Hesiod calls may fail because of:
2001-09-16 19:53:03 +04:00
.Bl -tag -width ECONNREFUSED -compact
.It Er ENOMEM
Insufficient memory was available to carry out the requested operation.
.It Er ENOEXEC
.Fn hesiod_init
1999-01-25 06:43:04 +03:00
failed because the Hesiod configuration file was invalid.
2001-09-16 19:53:03 +04:00
.It Er ECONNREFUSED
.Fn hesiod_resolve
1999-01-25 06:43:04 +03:00
failed because no name server could be contacted to answer the query.
2001-09-16 19:53:03 +04:00
.It Er EMSGSIZE
.Fn hesiod_resolve
1999-01-25 06:43:04 +03:00
or
2001-09-16 19:53:03 +04:00
.Fn hesiod_to_bind
1999-01-25 06:43:04 +03:00
failed because the query or response was too big to fit into the
packet buffers.
2001-09-16 19:53:03 +04:00
.It Er ENOENT
.Fn hesiod_resolve
1999-01-25 06:43:04 +03:00
failed because the name server had no text records matching
2001-09-16 19:53:03 +04:00
.Fa name
1999-01-25 06:43:04 +03:00
and
2001-09-16 19:53:03 +04:00
.Fa type ,
1999-01-25 06:43:04 +03:00
or
2001-09-16 19:53:03 +04:00
.Fn hesiod_to_bind
1999-01-25 06:43:04 +03:00
failed because the
2001-09-16 19:53:03 +04:00
.Fa name
1999-01-25 06:43:04 +03:00
argument had a domain extension which could not be resolved with type
2001-09-16 19:53:03 +04:00
.Dq rhs-extension
in the local Hesiod domain.
.El
.Sh SEE ALSO
.Xr hesiod.conf 5 ,
.Xr named 8
.Rs
.%T Hesiod - Project Athena Technical Plan -- Name Service
.Re
.Sh AUTHORS
1999-01-25 06:43:04 +03:00
Steve Dyer, IBM/Project Athena
.br
Greg Hudson, MIT Team Athena
.br
Copyright 1987, 1988, 1995, 1996 by the Massachusetts Institute of Technology.
2001-09-16 19:53:03 +04:00
.Sh BUGS
1999-01-25 06:43:04 +03:00
The strings corresponding to the
2001-09-16 19:53:03 +04:00
.Ev errno
1999-01-25 06:43:04 +03:00
values set by the Hesiod functions are not particularly indicative of
what went wrong, especially for
2001-09-16 19:53:03 +04:00
.Er ENOEXEC
1999-01-25 06:43:04 +03:00
and
2001-09-16 19:53:03 +04:00
.Er ENOENT .