| 65 |
65 |
| 66 /* Packet type */ |
66 /* Packet type */ |
| 67 typedef enum { |
67 typedef enum { |
| 68 UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT |
68 UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT |
| 69 } ZNotice_Kind_t; |
69 } ZNotice_Kind_t; |
| 70 extern const char *ZNoticeKinds[9]; |
|
| 71 |
70 |
| 72 /* Unique ID format */ |
71 /* Unique ID format */ |
| 73 typedef struct { |
72 typedef struct { |
| 74 struct in_addr zuid_addr; |
73 struct in_addr zuid_addr; |
| 75 struct timeval tv; |
74 struct timeval tv; |
| 127 char *user; |
126 char *user; |
| 128 ZUnique_Id_t uid; |
127 ZUnique_Id_t uid; |
| 129 char *version; |
128 char *version; |
| 130 } ZAsyncLocateData_t; |
129 } ZAsyncLocateData_t; |
| 131 |
130 |
| 132 /* for ZSetDebug */ |
|
| 133 #ifdef Z_DEBUG |
|
| 134 void (*__Z_debug_print)(const char *fmt, va_list args, void *closure); |
|
| 135 void *__Z_debug_print_closure; |
|
| 136 #endif |
|
| 137 |
|
| 138 int ZCompareUIDPred(ZNotice_t *, void *); |
131 int ZCompareUIDPred(ZNotice_t *, void *); |
| 139 int ZCompareMultiUIDPred(ZNotice_t *, void *); |
132 int ZCompareMultiUIDPred(ZNotice_t *, void *); |
| 140 |
133 |
| 141 /* Defines for ZFormatNotice, et al. */ |
134 /* Defines for ZFormatNotice, et al. */ |
| 142 typedef Code_t (*Z_AuthProc)(ZNotice_t *, char *, int, int *); |
135 typedef Code_t (*Z_AuthProc)(ZNotice_t *, char *, int, int *); |
| 165 Code_t ZLocateUser(char *, int *, Z_AuthProc); |
158 Code_t ZLocateUser(char *, int *, Z_AuthProc); |
| 166 Code_t ZRequestLocations(const char *, ZAsyncLocateData_t *, ZNotice_Kind_t, |
159 Code_t ZRequestLocations(const char *, ZAsyncLocateData_t *, ZNotice_Kind_t, |
| 167 Z_AuthProc); |
160 Z_AuthProc); |
| 168 Code_t ZhmStat(struct in_addr *, ZNotice_t *); |
161 Code_t ZhmStat(struct in_addr *, ZNotice_t *); |
| 169 Code_t ZInitialize(void); |
162 Code_t ZInitialize(void); |
| 170 Code_t ZSetServerState(int); |
|
| 171 Code_t ZSetFD(int); |
|
| 172 Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *); |
163 Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *); |
| 173 int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *); |
164 int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *); |
| 174 Code_t ZMakeAscii(char *, int, unsigned char *, int); |
165 Code_t ZMakeAscii(char *, int, unsigned char *, int); |
| 175 Code_t ZMakeAscii32(char *, int, unsigned long); |
166 Code_t ZMakeAscii32(char *, int, unsigned long); |
| 176 Code_t ZMakeAscii16(char *, int, unsigned int); |
167 Code_t ZMakeAscii16(char *, int, unsigned int); |
| 203 unsigned int port); |
194 unsigned int port); |
| 204 Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port); |
195 Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port); |
| 205 Code_t ZCancelSubscriptions(unsigned int port); |
196 Code_t ZCancelSubscriptions(unsigned int port); |
| 206 int ZPending(void); |
197 int ZPending(void); |
| 207 Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from); |
198 Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from); |
| 208 #ifdef Z_DEBUG |
|
| 209 void Z_debug(const char *, ...); |
|
| 210 #endif |
|
| 211 |
|
| 212 /* Compatibility */ |
|
| 213 #define ZNewLocateUser ZLocateUser |
|
| 214 |
199 |
| 215 /* Macros to retrieve Zephyr library values. */ |
200 /* Macros to retrieve Zephyr library values. */ |
| 216 extern int __Zephyr_fd; |
201 extern int __Zephyr_fd; |
| 217 extern int __Q_CompleteLength; |
202 extern int __Q_CompleteLength; |
| 218 extern struct sockaddr_in __HM_addr; |
203 extern struct sockaddr_in __HM_addr; |
| 219 extern char __Zephyr_realm[]; |
204 extern char __Zephyr_realm[]; |
| 220 #define ZGetFD() __Zephyr_fd |
205 #define ZGetFD() __Zephyr_fd |
| 221 #define ZQLength() __Q_CompleteLength |
206 #define ZQLength() __Q_CompleteLength |
| 222 #define ZGetDestAddr() __HM_addr |
207 #define ZGetDestAddr() __HM_addr |
| 223 #define ZGetRealm() __Zephyr_realm |
208 #define ZGetRealm() __Zephyr_realm |
| 224 |
|
| 225 #ifdef Z_DEBUG |
|
| 226 void ZSetDebug(void (*)(const char *, va_list, void *), void *); |
|
| 227 #define ZSetDebug(proc,closure) (__Z_debug_print=(proc), \ |
|
| 228 __Z_debug_print_closure=(closure), \ |
|
| 229 (void) 0) |
|
| 230 #else |
|
| 231 #define ZSetDebug(proc,closure) |
|
| 232 #endif |
|
| 233 |
209 |
| 234 /* Maximum queue length */ |
210 /* Maximum queue length */ |
| 235 #define Z_MAXQLEN 30 |
211 #define Z_MAXQLEN 30 |
| 236 |
212 |
| 237 /* Successful function return */ |
213 /* Successful function return */ |