2 * WSHelper DNS/Hesiod Library
4 * This file contains the function declaration for: \n
10 * hes_getservbyname() \n
22 * name of the hesiod configuration file. We will look at the file to determine the RHS AND LHS value before using the default.
23 * Here is a sample hesiod.cfg file: \n
25 * rhs .ATHENA.MIT.EDU \n
27 #define HESIOD_CONF "c:\\net\\tcp\\hesiod.cfg"
30 * default RHS value is the hesiod configuration file is not present
32 #define DEF_RHS ".Athena.MIT.EDU"
35 * default LHS value is the hesiod configuration file is not present
39 /*! \def HES_ER_UNINIT
40 * HES error code: uninitialized
42 #define HES_ER_UNINIT -1
45 * HES error code: no error
49 /*! \def HES_ER_NOTFOUND
50 * HES error code: Hesiod name not found by server
52 #define HES_ER_NOTFOUND 1
54 /*! \def HES_ER_CONFIG
55 * HES error code: local problem (no config file?)
57 #define HES_ER_CONFIG 2
60 * HES error code: network problem
69 /*! \fn LPSTR WINAPI hes_to_bind(LPSTR HesiodName, LPSTR HesiodNameType)
70 * hes_to_bind function use the LHS and RHS values and
71 * binds them with the parameters so that a well formed DNS query may
76 * \param[in] HesiodName The Hesiod name such as a username or service name
77 * \param[in] HesiodNameType The Hesiod name type such as pobox, passwd, or sloc
78 * \retval Returns NULL if there was an error. Otherwise the pointer to a string containing a valid query is returned.
88 /*! \fn LPSTR * WINAPI hes_resolve(LPSTR HesiodName, LPSTR HesiodNameType)
89 * This function calls hes_to_bind to form a valid hesiod query, then queries the dns database.
93 * \param[in] HesiodName The Hesiod name such as a username or service name
94 * \param[in] HesiodNameType The Hesiod name type such as pobox, passwd, or sloc
95 * \retval returns a NULL terminated vector of strings (a la argv),
96 * one for each resource record containing Hesiod data, or NULL if
97 * there is any error. If there is an error call hes_error() to get
98 * further information. You will need to call hes_free to free the result
108 /*! \fn int WINAPI hes_error(void)
109 * The function hes_error may be called to determine the
110 * source of the error. It does not take an argument.
112 * defined in hesiod.c
114 * \retval return one of the HES_ER_* codes defined in hesiod.h.
123 /*! \fn void WINAPI hes_free(LPSTR* hesinfo)
124 * The function hes_free should be called to free up memeory returned by hes_resolve
126 * defined in hesiod.c
128 * \param[in] hesinfo a NULL terminiated array of strings returned by hes_resolve
136 /*! \struct hes_postoffice
137 * For use in getting post-office information.
139 struct hes_postoffice {
140 /*! The post office type, e.g. POP, IMAP */
142 /*! The post office host, e.g. PO10.MIT.EDU */
144 /*! The account name on the post office, e.g. tom */
148 /*! \fn struct hes_postoffice * WINAPI hes_getmailhost(LPSTR user)
149 * This call is used to obtain a user's type of mail account and the location of that
150 * account. E.g. POP PO10.MIT.EDU or IMAP IMAP-TEST.MIT.EDU
152 * defined in hesmailh.c
154 * \param[in] user The username to be used when querying for the Hesiod Name Type POBOX.
155 * \retval NULL if there was an error or if there was no entry for the
156 * username. Otherwise a pointer to a hes_postoffice structure is
157 * returned. The caller must never attempt to modify this structure or to free
158 * any of its components. Furthermore, only one copy of this structure is allocated per call per thread, so the application should copy any information it needs before
159 * issuing another getmailhost call
161 struct hes_postoffice * WINAPI hes_getmailhost(LPSTR user);
163 /*! \fn struct servent * WINAPI hes_getservbyname(LPSTR name, LPSTR proto)
164 * This function will query a Hesiod server for a servent structure given
165 * a service name and protocol. This is a replacement for the Winsock
166 * getservbyname function which normally just uses a local services
167 * file. This allows a site to use a centralized database for adding new
170 * defined in hesservb.c
172 * \param[in] name pointer to the official name of the service, eg "POP3".
173 * \param[in] proto pointer to the protocol to use when contacting the service, e.g. "TCP"
174 * \retval NULL if there was an error or a pointer to a servent structure. The caller must
175 * never attempt to modify this structure or to free any of its components.
176 * Furthermore, only one copy of this structure is allocated per call per thread, so the application should copy any information it needs before
177 * issuing another hes_getservbyname call
180 struct servent * WINAPI hes_getservbyname(LPSTR name,
183 /*! \fn struct passwd * WINAPI hes_getpwnam(LPSTR nam)
184 * Given a username this function will return the pwd information, eg
185 * username, uid, gid, fullname, office location, phone number, home
186 * directory, and default shell
188 * defined in hespwnam.c
190 * \param nam a pointer to the username
191 * \retval NULL if there was an error or a pointer to the passwd structure. The caller must
192 * never attempt to modify this structure or to free any of its components.
193 * Furthermore, only one copy of this structure is allocated per call per thread, so the application should copy any information it needs before
194 * issuing another hes_getpwnam call
197 struct passwd * WINAPI hes_getpwnam(LPSTR nam);
199 /*! struct passwd * WINAPI hes_getpwuid(int uid)
200 * Given a UID this function will return the pwd information, eg username, uid,
201 * gid, fullname, office location, phone number, home directory, and default shell
203 * defined in hespwnam.c
205 * \param uid The user ID
206 * \retval NULL if there was an error or a pointer to the passwd structure. The caller must
207 * never attempt to modify this structure or to free any of its components.
208 * Furthermore, only one copy of this structure is allocated per call per thread, so the application should copy any information it needs before
209 * issuing another hes_getpwuid call
211 struct passwd * WINAPI hes_getpwuid(int uid);
217 #endif /* _HESIOD_ */