1 /* $Id: hesiod.h,v 1.5 2000/01/05 16:28:51 ghudson Exp $ */
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
20 #ifndef HESIOD__INCLUDED
21 #define HESIOD__INCLUDED
23 #include <sys/types.h>
27 /* Application-visible define to signal that we have the new interfaces. */
28 #define HESIOD_INTERFACES
30 struct hesiod_postoffice {
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 char **hesiod_parse_result(void *context, const unsigned char *abuf, int alen);
41 void hesiod_free_string(void *context, char *str);
42 void hesiod_free_list(void *context, char **list);
43 struct passwd *hesiod_getpwnam(void *context, const char *name);
44 struct passwd *hesiod_getpwuid(void *context, uid_t uid);
45 void hesiod_free_passwd(void *context, struct passwd *pw);
46 struct servent *hesiod_getservbyname(void *context, const char *name,
48 void hesiod_free_servent(void *context, struct servent *serv);
49 struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user);
50 void hesiod_free_postoffice(void *context, struct hesiod_postoffice *po);
52 /* Compatibility stuff. */
54 #define HES_ER_UNINIT -1 /* uninitialized */
55 #define HES_ER_OK 0 /* no error */
56 #define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */
57 #define HES_ER_CONFIG 2 /* local problem (no config file?) */
58 #define HES_ER_NET 3 /* network problem */
60 struct hes_postoffice {
67 char *hes_to_bind(const char *name, const char *type);
68 char **hes_resolve(const char *name, const char *type);
70 struct passwd *hes_getpwnam(const char *name);
71 struct passwd *hes_getpwuid(uid_t uid);
72 struct servent *hes_getservbyname(const char *name, const char *proto);
73 struct hes_postoffice *hes_getmailhost(const char *name);