skyrope-mit-merge-hell-20040226
[openafs.git] / src / WINNT / kfw / inc / wshelper / hesiod.h
1 /* This file contains definitions for use by the Hesiod name service and
2  * applications.
3  *
4  * @doc
5  *
6  * @module hesiod.h |
7  * For copying and distribution information, see the file 
8  * <gt> mit-copyright.h <lt>.
9  *
10  * Original version by Steve Dyer, IBM/Project Athena.
11  * 
12  */
13
14 /* Configuration information. */
15
16 #ifndef _HESIOD_
17 #define _HESIOD_
18
19 #if defined(_WINDOWS) || defined(_WIN32)
20 #include <windows.h>
21 #endif
22
23 #if defined(_WINDOWS) || defined(_WIN32)
24 #define HESIOD_CONF     "c:\\net\\tcp\\hesiod.cfg"
25 #else
26 #define HESIOD_CONF     "/etc/hesiod.conf"      /* Configuration file. */
27 #endif
28
29 #define DEF_RHS         ".Athena.MIT.EDU"       /* Defaults if HESIOD_CONF */
30 #define DEF_LHS         ".ns"                   /*    file is not present. */
31
32 /* @doc ERROR
33 /* Error codes. */
34 /*
35
36 @type HES_ER_UNINIT   | -1      uninitialized 
37 @type HES_ER_OK       | 0       no error 
38 @type HES_ER_NOTFOUND | 1       Hesiod name not found by server 
39 @type HES_ER_CONFIG   | 2       local problem (no config file?) 
40 @type HES_ER_NET      | 3        network problem
41
42  */
43
44 #define HES_ER_UNINIT   -1      /* uninitialized */
45 #define HES_ER_OK       0       /* no error */
46 #define HES_ER_NOTFOUND 1       /* Hesiod name not found by server */
47 #define HES_ER_CONFIG   2       /* local problem (no config file?) */
48 #define HES_ER_NET      3       /* network problem */
49
50 /* Declaration of routines */
51
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55
56 #if defined(_WINDOWS) || defined(_WIN32)
57
58 LPSTR WINAPI
59 hes_to_bind(
60     LPSTR HesiodName, 
61     LPSTR HesiodNameType
62     );
63
64 LPSTR * WINAPI
65 hes_resolve(
66     LPSTR HesiodName,
67     LPSTR HesiodNameType
68     );
69
70 int WINAPI
71 hes_error(
72     void
73     );
74
75 #else 
76 char *hes_to_bind(const char *name, const char *type);
77 char **hes_resolve(const char *name, const char *type);
78 int hes_error(void);
79 #endif /* WINDOWS */
80
81
82 /*
83  * @doc
84  *
85  * @struct hes_postoffice | For use in getting post-office information.
86  *
87  * @field LPSTR   | po_type | The post office type, e.g. POP, IMAP 
88  * @field LPSTR   | po_host | The post office host, e.g. PO10.MIT.EDU
89  * @field LPSTR   | po_name | The account name on the post office, e.g. tom
90  *
91  */
92 #if defined(_WINDOWS) || defined(_WIN32)
93 struct hes_postoffice {
94     LPSTR   po_type;
95     LPSTR   po_host;
96     LPSTR   po_name;
97 };
98 #else
99 struct hes_postoffice {
100     char    *po_type;
101     char    *po_host;
102     char    *po_name;
103 };
104 #endif
105
106 /* Other routines */
107
108 #if defined(_WINDOWS) || defined(_WIN32)
109 struct hes_postoffice FAR * WINAPI hes_getmailhost(LPSTR user);
110 struct servent FAR * WINAPI hes_getservbyname(LPSTR name, 
111                                                               LPSTR proto);
112 struct passwd FAR * WINAPI hes_getpwnam(LPSTR nam);
113 struct passwd FAR * WINAPI hes_getpwuid(int uid);
114 #else
115 struct hes_postoffice *hes_getmailhost();
116 struct servent *hes_getservbyname();
117 struct passwd *hes_getpwnam();
118 struct passwd *hes_getpwuid();
119 #endif
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* _HESIOD_ */