Mercurial > pidgin.yaz
annotate src/protocols/zephyr/zephyr.h @ 10850:fa06fda62868
[gaim-migrate @ 12522]
GET OUTTA MY HOUSE!!!
Thanks to Gary for showing me a list of non-namespaced stuff. I'm sure
I missed some.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 19 Apr 2005 04:43:13 +0000 |
parents | 08ce2a94d9c7 |
children | 5727afad0fb8 |
rev | line source |
---|---|
2086 | 1 /* This file is part of the Project Athena Zephyr Notification System. |
2 * It contains global definitions | |
3 * | |
4 * Created by: Robert French | |
5 * | |
6 * $Source$ | |
7475 | 7 * $Author: thekingant $ |
8 * $Id: zephyr.h 8088 2003-11-11 07:08:13Z thekingant $ | |
2086 | 9 * |
10 * Copyright (c) 1987,1988,1991 by the Massachusetts Institute of | |
11 * Technology. For copying and distribution information, see the | |
12 * file "mit-copyright.h". | |
13 */ | |
14 | |
15 #ifndef __ZEPHYR_H__ | |
16 #define __ZEPHYR_H__ | |
17 | |
18 #include <config.h> | |
19 | |
20 #include <sys/types.h> | |
21 #include <sys/time.h> | |
22 | |
23 #include <zephyr/zephyr_err.h> | |
24 | |
25 #ifndef IPPROTO_MAX /* Make sure not already included */ | |
26 #include <netinet/in.h> | |
27 #endif | |
28 | |
29 /* Use __STDC__ to guess whether we can use stdarg, prototypes, and const. | |
30 * This is a public header file, so autoconf can't help us here. */ | |
31 #ifdef __STDC__ | |
32 # include <stdarg.h> | |
33 # define ZP(x) x | |
34 # define ZCONST const | |
35 #else | |
36 # define ZP(x) () | |
37 # define ZCONST | |
38 #endif | |
39 | |
40 /* Service names */ | |
41 #define HM_SVCNAME "zephyr-hm" | |
42 #define HM_SRV_SVCNAME "zephyr-hm-srv" | |
43 #define SERVER_SVCNAME "zephyr-clt" | |
44 #define SERVER_SERVICE "zephyr" | |
45 #define SERVER_INSTANCE "zephyr" | |
46 | |
47 #define ZVERSIONHDR "ZEPH" | |
48 #define ZVERSIONMAJOR 0 | |
49 #define ZVERSIONMINOR 2 | |
50 | |
51 #define Z_MAXPKTLEN 1024 | |
52 #define Z_MAXHEADERLEN 800 | |
53 #define Z_MAXOTHERFIELDS 10 /* Max unknown fields in ZNotice_t */ | |
54 #define Z_NUMFIELDS 17 | |
55 | |
56 /* Authentication levels returned by ZCheckAuthentication */ | |
57 #define ZAUTH_FAILED (-1) | |
58 #define ZAUTH_YES 1 | |
59 #define ZAUTH_NO 0 | |
60 | |
61 typedef char ZPacket_t[Z_MAXPKTLEN]; | |
62 | |
63 /* Packet type */ | |
64 typedef enum { | |
65 UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT | |
66 } ZNotice_Kind_t; | |
67 extern ZCONST char *ZNoticeKinds[9]; | |
68 | |
69 /* Unique ID format */ | |
70 typedef struct _ZUnique_Id_t { | |
71 struct in_addr zuid_addr; | |
72 struct timeval tv; | |
73 } ZUnique_Id_t; | |
74 | |
75 /* Checksum */ | |
76 typedef unsigned long ZChecksum_t; | |
77 | |
78 /* Notice definition */ | |
79 typedef struct _ZNotice_t { | |
80 char *z_packet; | |
81 char *z_version; | |
82 ZNotice_Kind_t z_kind; | |
83 ZUnique_Id_t z_uid; | |
84 #define z_sender_addr z_uid.zuid_addr | |
85 struct timeval z_time; | |
86 unsigned short z_port; | |
87 int z_auth; | |
88 int z_checked_auth; | |
89 int z_authent_len; | |
90 char *z_ascii_authent; | |
91 char *z_class; | |
7261 | 92 const char *z_class_inst; |
2086 | 93 char *z_opcode; |
94 char *z_sender; | |
5136 | 95 const char *z_recipient; |
2086 | 96 char *z_default_format; |
97 char *z_multinotice; | |
98 ZUnique_Id_t z_multiuid; | |
99 ZChecksum_t z_checksum; | |
100 int z_num_other_fields; | |
101 char *z_other_fields[Z_MAXOTHERFIELDS]; | |
7475 | 102 void *z_message; |
2086 | 103 int z_message_len; |
104 } ZNotice_t; | |
105 | |
106 /* Subscription structure */ | |
107 typedef struct _ZSubscriptions_t { | |
108 char *zsub_recipient; | |
109 char *zsub_class; | |
110 char *zsub_classinst; | |
111 } ZSubscription_t; | |
112 | |
113 /* Function return code */ | |
114 typedef int Code_t; | |
115 | |
116 /* Locations structure */ | |
117 typedef struct _ZLocations_t { | |
118 char *host; | |
119 char *time; | |
120 char *tty; | |
121 } ZLocations_t; | |
122 | |
123 typedef struct _ZAsyncLocateData_t { | |
124 char *user; | |
125 ZUnique_Id_t uid; | |
126 char *version; | |
127 } ZAsyncLocateData_t; | |
128 | |
129 /* for ZSetDebug */ | |
130 #ifdef Z_DEBUG | |
131 void (*__Z_debug_print) ZP((ZCONST char *fmt, va_list args, void *closure)); | |
132 void *__Z_debug_print_closure; | |
133 #endif | |
134 | |
135 int ZCompareUIDPred ZP((ZNotice_t *, void *)); | |
136 int ZCompareMultiUIDPred ZP((ZNotice_t *, void *)); | |
137 | |
138 /* Defines for ZFormatNotice, et al. */ | |
139 typedef Code_t (*Z_AuthProc) ZP((ZNotice_t*, char *, int, int *)); | |
140 Code_t ZMakeAuthentication ZP((ZNotice_t*, char *,int, int*)); | |
141 | |
142 char *ZGetSender ZP((void)); | |
143 char *ZGetVariable ZP((char *)); | |
144 Code_t ZSetVariable ZP((char *var, char *value)); | |
145 Code_t ZUnsetVariable ZP((char *var)); | |
146 int ZGetWGPort ZP((void)); | |
147 Code_t ZSetDestAddr ZP((struct sockaddr_in *)); | |
148 Code_t ZFormatNoticeList ZP((ZNotice_t*, char**, int, | |
149 char **, int*, Z_AuthProc)); | |
150 Code_t ZParseNotice ZP((char*, int, ZNotice_t *)); | |
151 Code_t ZReadAscii ZP((char*, int, unsigned char*, int)); | |
152 Code_t ZReadAscii32 ZP((char *, int, unsigned long *)); | |
153 Code_t ZReadAscii16 ZP((char *, int, unsigned short *)); | |
154 Code_t ZSendPacket ZP((char*, int, int)); | |
155 Code_t ZSendList ZP((ZNotice_t*, char *[], int, Z_AuthProc)); | |
156 Code_t ZSrvSendList ZP((ZNotice_t*, char*[], int, Z_AuthProc, Code_t (*)())); | |
157 Code_t ZSendNotice ZP((ZNotice_t *, Z_AuthProc)); | |
158 Code_t ZSrvSendNotice ZP((ZNotice_t*, Z_AuthProc, Code_t (*)())); | |
159 Code_t ZFormatNotice ZP((ZNotice_t*, char**, int*, Z_AuthProc)); | |
160 Code_t ZFormatSmallNotice ZP((ZNotice_t*, ZPacket_t, int*, Z_AuthProc)); | |
161 Code_t ZFormatRawNoticeList ZP((ZNotice_t *notice, char *list[], int nitems, | |
162 char **buffer, int *ret_len)); | |
163 Code_t ZLocateUser ZP((char *, int *, Z_AuthProc)); | |
7261 | 164 Code_t ZRequestLocations ZP((const char *, ZAsyncLocateData_t *, |
2086 | 165 ZNotice_Kind_t, Z_AuthProc)); |
2419
7ba69b8e0de5
[gaim-migrate @ 2432]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
166 Code_t ZhmStat ZP((struct in_addr *, ZNotice_t *)); |
2086 | 167 Code_t ZInitialize ZP((void)); |
168 Code_t ZSetServerState ZP((int)); | |
169 Code_t ZSetFD ZP((int)); | |
170 Code_t ZFormatSmallRawNotice ZP((ZNotice_t*, ZPacket_t, int*)); | |
171 int ZCompareUID ZP((ZUnique_Id_t*, ZUnique_Id_t*)); | |
172 Code_t ZSrvSendRawList ZP((ZNotice_t*, char*[], int, | |
173 Code_t (*)(ZNotice_t *, char *, int, int))); | |
174 Code_t ZMakeAscii ZP((char*, int, unsigned char*, int)); | |
175 Code_t ZMakeAscii32 ZP((char *, int, unsigned long)); | |
176 Code_t ZMakeAscii16 ZP((char *, int, unsigned int)); | |
177 Code_t ZReceivePacket ZP((ZPacket_t, int*, struct sockaddr_in*)); | |
178 Code_t ZCheckAuthentication ZP((ZNotice_t*, struct sockaddr_in*)); | |
2419
7ba69b8e0de5
[gaim-migrate @ 2432]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
179 Code_t ZSetLocation ZP((char *exposure)); |
7ba69b8e0de5
[gaim-migrate @ 2432]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
180 Code_t ZUnsetLocation ZP((void)); |
2086 | 181 Code_t ZFlushMyLocations ZP((void)); |
182 Code_t ZFormatRawNotice ZP((ZNotice_t *, char**, int *)); | |
183 Code_t ZRetrieveSubscriptions ZP((unsigned short, int*)); | |
184 Code_t ZOpenPort ZP((unsigned short *port)); | |
185 Code_t ZClosePort ZP((void)); | |
186 Code_t ZFlushLocations ZP((void)); | |
187 Code_t ZFlushSubscriptions ZP((void)); | |
188 Code_t ZFreeNotice ZP((ZNotice_t *notice)); | |
189 Code_t ZParseLocations ZP((register ZNotice_t *notice, | |
190 register ZAsyncLocateData_t *zald, int *nlocs, | |
191 char **user)); | |
192 int ZCompareALDPred ZP((ZNotice_t *notice, void *zald)); | |
193 void ZFreeALD ZP((register ZAsyncLocateData_t *zald)); | |
194 Code_t ZCheckIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, | |
195 register int (*predicate) ZP((ZNotice_t *,void *)), | |
196 void *args)); | |
197 Code_t ZPeekPacket ZP((char **buffer, int *ret_len, | |
198 struct sockaddr_in *from)); | |
199 Code_t ZPeekNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); | |
200 Code_t ZIfNotice ZP((ZNotice_t *notice, struct sockaddr_in *from, | |
201 int (*predicate) ZP((ZNotice_t *, void *)), void *args)); | |
202 Code_t ZSubscribeTo ZP((ZSubscription_t *sublist, int nitems, | |
203 unsigned int port)); | |
204 Code_t ZSubscribeToSansDefaults ZP((ZSubscription_t *sublist, int nitems, | |
205 unsigned int port)); | |
206 Code_t ZUnsubscribeTo ZP((ZSubscription_t *sublist, int nitems, | |
207 unsigned int port)); | |
208 Code_t ZCancelSubscriptions ZP((unsigned int port)); | |
209 int ZPending ZP((void)); | |
210 Code_t ZReceiveNotice ZP((ZNotice_t *notice, struct sockaddr_in *from)); | |
211 #ifdef Z_DEBUG | |
212 void Z_debug ZP((ZCONST char *, ...)); | |
213 #endif | |
214 | |
215 #undef ZP | |
216 | |
217 /* Compatibility */ | |
218 #define ZNewLocateUser ZLocateUser | |
219 | |
220 /* Macros to retrieve Zephyr library values. */ | |
221 extern int __Zephyr_fd; | |
222 extern int __Q_CompleteLength; | |
223 extern struct sockaddr_in __HM_addr; | |
224 extern char __Zephyr_realm[]; | |
225 #define ZGetFD() __Zephyr_fd | |
226 #define ZQLength() __Q_CompleteLength | |
227 #define ZGetDestAddr() __HM_addr | |
228 #define ZGetRealm() __Zephyr_realm | |
229 | |
230 #ifdef Z_DEBUG | |
231 void ZSetDebug ZP((void (*)(ZCONST char *, va_list, void *), void *)); | |
232 #define ZSetDebug(proc,closure) (__Z_debug_print=(proc), \ | |
233 __Z_debug_print_closure=(closure), \ | |
234 (void) 0) | |
235 #else | |
236 #define ZSetDebug(proc,closure) | |
237 #endif | |
238 | |
239 /* Maximum queue length */ | |
240 #define Z_MAXQLEN 30 | |
241 | |
242 /* Successful function return */ | |
243 #define ZERR_NONE 0 | |
244 | |
245 /* Hostmanager wait time (in secs) */ | |
246 #define HM_TIMEOUT 10 | |
247 | |
248 /* Server wait time (in secs) */ | |
249 #define SRV_TIMEOUT 30 | |
250 | |
251 #define ZAUTH (ZMakeAuthentication) | |
252 #define ZNOAUTH ((Z_AuthProc)0) | |
253 | |
254 /* Packet strings */ | |
255 #define ZSRVACK_SENT "SENT" /* SERVACK codes */ | |
256 #define ZSRVACK_NOTSENT "LOST" | |
257 #define ZSRVACK_FAIL "FAIL" | |
258 | |
259 /* Server internal class */ | |
260 #define ZEPHYR_ADMIN_CLASS "ZEPHYR_ADMIN" /* Class */ | |
261 | |
262 /* Control codes sent to a server */ | |
263 #define ZEPHYR_CTL_CLASS "ZEPHYR_CTL" /* Class */ | |
264 | |
265 #define ZEPHYR_CTL_CLIENT "CLIENT" /* Inst: From client */ | |
266 #define CLIENT_SUBSCRIBE "SUBSCRIBE" /* Opcode: Subscribe */ | |
267 #define CLIENT_SUBSCRIBE_NODEFS "SUBSCRIBE_NODEFS" /* Opcode: Subscribe */ | |
268 #define CLIENT_UNSUBSCRIBE "UNSUBSCRIBE" /* Opcode: Unsubsubscribe */ | |
269 #define CLIENT_CANCELSUB "CLEARSUB" /* Opcode: Clear all subs */ | |
270 #define CLIENT_GIMMESUBS "GIMME" /* Opcode: Give me subs */ | |
271 #define CLIENT_GIMMEDEFS "GIMMEDEFS" /* Opcode: Give me default | |
272 * subscriptions */ | |
273 | |
274 #define ZEPHYR_CTL_HM "HM" /* Inst: From HM */ | |
275 #define HM_BOOT "BOOT" /* Opcode: Boot msg */ | |
276 #define HM_FLUSH "FLUSH" /* Opcode: Flush me */ | |
277 #define HM_DETACH "DETACH" /* Opcode: Detach me */ | |
278 #define HM_ATTACH "ATTACH" /* Opcode: Attach me */ | |
279 | |
280 /* Control codes send to a HostManager */ | |
281 #define HM_CTL_CLASS "HM_CTL" /* Class */ | |
282 | |
283 #define HM_CTL_SERVER "SERVER" /* Inst: From server */ | |
284 #define SERVER_SHUTDOWN "SHUTDOWN" /* Opcode: Server shutdown */ | |
285 #define SERVER_PING "PING" /* Opcode: PING */ | |
286 | |
287 #define HM_CTL_CLIENT "CLIENT" /* Inst: From client */ | |
288 #define CLIENT_FLUSH "FLUSH" /* Opcode: Send flush to srv */ | |
289 #define CLIENT_NEW_SERVER "NEWSERV" /* Opcode: Find new server */ | |
290 | |
291 /* HM Statistics */ | |
292 #define HM_STAT_CLASS "HM_STAT" /* Class */ | |
293 | |
294 #define HM_STAT_CLIENT "HMST_CLIENT" /* Inst: From client */ | |
295 #define HM_GIMMESTATS "GIMMESTATS" /* Opcode: get stats */ | |
296 | |
297 /* Login class messages */ | |
298 #define LOGIN_CLASS "LOGIN" /* Class */ | |
299 | |
300 /* Class Instance is principal of user who is logging in or logging out */ | |
301 | |
302 #define EXPOSE_NONE "NONE" /* Opcode: Not visible */ | |
303 #define EXPOSE_OPSTAFF "OPSTAFF" /* Opcode: Opstaff visible */ | |
304 #define EXPOSE_REALMVIS "REALM-VISIBLE" /* Opcode: Realm visible */ | |
305 #define EXPOSE_REALMANN "REALM-ANNOUNCED"/* Opcode: Realm announced */ | |
306 #define EXPOSE_NETVIS "NET-VISIBLE" /* Opcode: Net visible */ | |
307 #define EXPOSE_NETANN "NET-ANNOUNCED" /* Opcode: Net announced */ | |
308 #define LOGIN_USER_LOGIN "USER_LOGIN" /* Opcode: user login | |
309 (from server) */ | |
310 #define LOGIN_USER_LOGOUT "USER_LOGOUT" /* Opcode: User logout */ | |
311 #define LOGIN_USER_FLUSH "USER_FLUSH" /* Opcode: flush all locs */ | |
312 | |
313 /* Locate class messages */ | |
314 #define LOCATE_CLASS "USER_LOCATE" /* Class */ | |
315 | |
316 #define LOCATE_HIDE "USER_HIDE" /* Opcode: Hide me */ | |
317 #define LOCATE_UNHIDE "USER_UNHIDE" /* Opcode: Unhide me */ | |
318 | |
319 /* Class Instance is principal of user to locate */ | |
320 #define LOCATE_LOCATE "LOCATE" /* Opcode: Locate user */ | |
321 | |
322 /* WG_CTL class messages */ | |
323 #define WG_CTL_CLASS "WG_CTL" /* Class */ | |
324 | |
325 #define WG_CTL_USER "USER" /* Inst: User request */ | |
326 #define USER_REREAD "REREAD" /* Opcode: Reread desc file */ | |
327 #define USER_SHUTDOWN "SHUTDOWN" /* Opcode: Go catatonic */ | |
328 #define USER_STARTUP "STARTUP" /* Opcode: Come out of it */ | |
2419
7ba69b8e0de5
[gaim-migrate @ 2432]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2086
diff
changeset
|
329 #define USER_EXIT "EXIT" /* Opcode: Exit the client */ |
2086 | 330 |
331 #endif /* __ZEPHYR_H__ */ |