1 /* $Id: hesiod.h,v 1.5 2000-01-05 16:28:51 ghudson Exp $ */ 2 3 /* 4 * Copyright (c) 1996 by Internet Software Consortium. 5 * 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. 9 * 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. 18 */ 19 20 #ifndef HESIOD__INCLUDED 21 #define HESIOD__INCLUDED 22 23 #include <sys/types.h> 24 #include <pwd.h> 25 #include <netdb.h> 26 27 /* Application-visible define to signal that we have the new interfaces. */ 28 #define HESIOD_INTERFACES 29 30 struct hesiod_postoffice { 31 char *hesiod_po_type; 32 char *hesiod_po_host; 33 char *hesiod_po_name; 34 }; 35 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, 47 const char *proto); 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); 51 52 /* Compatibility stuff. */ 53 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 */ 59 60 struct hes_postoffice { 61 char *po_type; 62 char *po_host; 63 char *po_name; 64 }; 65 66 int hes_init(void); 67 char *hes_to_bind(const char *name, const char *type); 68 char **hes_resolve(const char *name, const char *type); 69 int hes_error(void); 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); 74 75 #endif 76