Update.
[glibc.git] / hesiod / hesiod.h
blob9c3d323811dacbf9656d094cd321425913e5ffc0
1 /* $Id$ */
3 /*
4 * Copyright (c) 1996 by Internet Software Consortium.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
11 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
13 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
16 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
17 * SOFTWARE.
20 #ifndef HESIOD__INCLUDED
21 #define HESIOD__INCLUDED
23 #include <sys/types.h>
24 #include <pwd.h>
25 #include <netdb.h>
27 /* Application-visible define to signal that we have the new interfaces. */
28 #define HESIOD_INTERFACES
30 struct hesiod_postoffice {
31 char *hesiod_po_type;
32 char *hesiod_po_host;
33 char *hesiod_po_name;
36 int hesiod_init(void **context);
37 void hesiod_end(void *context);
38 char *hesiod_to_bind(void *context, const char *name, const char *type);
39 char **hesiod_resolve(void *context, const char *name, const char *type);
40 void hesiod_free_list(void *context, char **list);
41 struct passwd *hesiod_getpwnam(void *context, const char *name);
42 struct passwd *hesiod_getpwuid(void *context, uid_t uid);
43 void hesiod_free_passwd(void *context, struct passwd *pw);
44 struct servent *hesiod_getservbyname(void *context, const char *name,
45 const char *proto);
46 void hesiod_free_servent(void *context, struct servent *serv);
47 struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user);
48 void hesiod_free_postoffice(void *context, struct hesiod_postoffice *po);
50 /* Compatibility stuff. */
52 #define HES_ER_UNINIT -1 /* uninitialized */
53 #define HES_ER_OK 0 /* no error */
54 #define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */
55 #define HES_ER_CONFIG 2 /* local problem (no config file?) */
56 #define HES_ER_NET 3 /* network problem */
58 struct hes_postoffice {
59 char *po_type;
60 char *po_host;
61 char *po_name;
64 int hes_init(void);
65 char *hes_to_bind(const char *name, const char *type);
66 char **hes_resolve(const char *name, const char *type);
67 int hes_error(void);
68 struct passwd *hes_getpwnam(const char *name);
69 struct passwd *hes_getpwuid(uid_t uid);
70 struct servent *hes_getservbyname(const char *name, const char *proto);
71 struct hes_postoffice *hes_getmailhost(const char *name);
73 #endif