1 /* $Id: hesiod.h,v 1.2 2001/12/04 02:05:57 rjs3 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 <KerberosSupport/KerberosConditionalMacros.h> 24 25 #if TARGET_RT_MAC_CFM 26 #include <MacTypes.h> 27 #include <KerberosSupport/netdb.h> 28 #include <KerberosSupport/pwd.h> 29 #endif 30 31 #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 32 # pragma import on 33 #endif 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /* Application-visible define to signal that we have the new interfaces. */ 40 #define HESIOD_INTERFACES 41 42 struct hesiod_postoffice { 43 char *hesiod_po_type; 44 char *hesiod_po_host; 45 char *hesiod_po_name; 46 }; 47 48 49 /* Library control functions */ 50 #define HesiodLibIsPresent_ ((Ptr) hesiod_init != (Ptr) kUnresolvedCFragSymbolAddress) 51 52 OSStatus hesiod_abort_operations(void); 53 54 55 /* Hesiod API functions */ 56 int hesiod_init(void **context); 57 void hesiod_end(void *context); 58 char *hesiod_to_bind(void *context, const char *name, const char *type); 59 char **hesiod_resolve(void *context, const char *name, const char *type); 60 void hesiod_free_list(void *context, char **list); 61 struct passwd *hesiod_getpwnam(void *context, const char *name); 62 struct passwd *hesiod_getpwuid(void *context, uid_t uid); 63 void hesiod_free_passwd(void *context, struct passwd *pw); 64 struct servent *hesiod_getservbyname(void *context, const char *name, 65 const char *proto); 66 void hesiod_free_servent(void *context, struct servent *serv); 67 struct hesiod_postoffice *hesiod_getmailhost(void *context, const char *user); 68 void hesiod_free_postoffice(void *context, struct hesiod_postoffice *po); 69 70 /* Compatibility stuff. */ 71 72 #define HES_ER_UNINIT -1 /* uninitialized */ 73 #define HES_ER_OK 0 /* no error */ 74 #define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */ 75 #define HES_ER_CONFIG 2 /* local problem (no config file?) */ 76 #define HES_ER_NET 3 /* network problem */ 77 78 struct hes_postoffice { 79 char *po_type; 80 char *po_host; 81 char *po_name; 82 }; 83 84 int hes_init(void); 85 char *hes_to_bind(const char *name, const char *type); 86 char **hes_resolve(const char *name, const char *type); 87 int hes_error(void); 88 struct passwd *hes_getpwnam(const char *name); 89 struct passwd *hes_getpwuid(uid_t uid); 90 struct servent *hes_getservbyname(const char *name, const char *proto); 91 struct hes_postoffice *hes_getmailhost(const char *name); 92 93 #ifdef __cplusplus 94 } 95 #endif 96 97 #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 98 # pragma import reset 99 #endif 100 101 #endif /* HESIOD__INCLUDED */ 102