libpurple/protocols/zephyr/zephyr_internal.h

changeset 40643
1c9bdf8d3e85
parent 40633
d884c4b6e202
child 40657
4942603c98ae
equal deleted inserted replaced
40642:18050336a45f 40643:1c9bdf8d3e85
14 #ifdef HAVE_CONFIG_H 14 #ifdef HAVE_CONFIG_H
15 # include <config.h> 15 # include <config.h>
16 #endif 16 #endif
17 17
18 #include <glib.h> 18 #include <glib.h>
19 #include <gio/gio.h>
19 20
20 #include <sys/types.h> 21 #include <sys/types.h>
21 #include <sys/time.h> 22 #include <sys/time.h>
22 23
23 #include <zephyr_err.h> 24 #include <zephyr_err.h>
59 /* Authentication levels returned by ZCheckAuthentication */ 60 /* Authentication levels returned by ZCheckAuthentication */
60 #define ZAUTH_FAILED (-1) 61 #define ZAUTH_FAILED (-1)
61 #define ZAUTH_YES 1 62 #define ZAUTH_YES 1
62 #define ZAUTH_NO 0 63 #define ZAUTH_NO 0
63 64
64 #define SERVER_SVC_FALLBACK htons((unsigned short) 2103) 65 #define SERVER_SVC_FALLBACK (2103)
65 #define HM_SVC_FALLBACK htons((unsigned short) 2104) 66 #define HM_SVC_FALLBACK (2104)
66 #define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105) 67 #define HM_SRV_SVC_FALLBACK (2105)
67 68
68 #define ZAUTH_UNSET (-3) /* Internal to client library. */ 69 #define ZAUTH_UNSET (-3) /* Internal to client library. */
69 #define Z_MAXFRAGS 500 /* Max number of packet fragments */ 70 #define Z_MAXFRAGS 500 /* Max number of packet fragments */
70 #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */ 71 #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */
71 #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */ 72 #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */
80 UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT 81 UNSAFE, UNACKED, ACKED, HMACK, HMCTL, SERVACK, SERVNAK, CLIENTACK, STAT
81 } ZNotice_Kind_t; 82 } ZNotice_Kind_t;
82 83
83 /* Unique ID format */ 84 /* Unique ID format */
84 typedef struct { 85 typedef struct {
85 struct in_addr zuid_addr; 86 guint32 zuid_addr;
86 struct timeval tv; 87 struct timeval tv;
87 } ZUnique_Id_t; 88 } ZUnique_Id_t;
88 89
89 /* Checksum */ 90 /* Checksum */
90 typedef unsigned long ZChecksum_t; 91 typedef unsigned long ZChecksum_t;
149 ZNotice_Kind_t kind; 150 ZNotice_Kind_t kind;
150 gint64 time; 151 gint64 time;
151 gint packet_len; 152 gint packet_len;
152 gchar *packet; 153 gchar *packet;
153 gboolean complete; 154 gboolean complete;
154 struct sockaddr_in from; 155 GSocketAddress *from;
155 GSList *holelist; /* element-type: Z_Hole* */ 156 GSList *holelist; /* element-type: Z_Hole* */
156 ZUnique_Id_t uid; 157 ZUnique_Id_t uid;
157 int auth; 158 int auth;
158 gint header_len; 159 gint header_len;
159 gchar *header; 160 gchar *header;
171 char *ZGetSender(void); 172 char *ZGetSender(void);
172 const gchar *ZGetVariable(const gchar *); 173 const gchar *ZGetVariable(const gchar *);
173 Code_t ZSetVariable(char *var, char *value); 174 Code_t ZSetVariable(char *var, char *value);
174 Code_t ZUnsetVariable(char *var); 175 Code_t ZUnsetVariable(char *var);
175 int ZGetWGPort(void); 176 int ZGetWGPort(void);
176 Code_t ZSetDestAddr(struct sockaddr_in *); 177 Code_t ZSetDestAddr(GSocketAddress *);
177 Code_t ZFormatNoticeList(ZNotice_t *, char **, int, char **, int *, Z_AuthProc); 178 Code_t ZFormatNoticeList(ZNotice_t *, char **, int, char **, int *, Z_AuthProc);
178 Code_t ZParseNotice(char *, int, ZNotice_t *); 179 Code_t ZParseNotice(char *, int, ZNotice_t *);
179 Code_t ZReadAscii(char *, int, unsigned char *, int); 180 Code_t ZReadAscii(char *, int, unsigned char *, int);
180 Code_t ZReadAscii32(char *, int, unsigned long *); 181 Code_t ZReadAscii32(char *, int, unsigned long *);
181 Code_t ZReadAscii16(char *, int, unsigned short *); 182 Code_t ZReadAscii16(char *, int, unsigned short *);
189 Code_t ZFormatRawNoticeList(ZNotice_t *notice, char *list[], int nitems, 190 Code_t ZFormatRawNoticeList(ZNotice_t *notice, char *list[], int nitems,
190 char **buffer, int *ret_len); 191 char **buffer, int *ret_len);
191 Code_t ZLocateUser(char *, int *, Z_AuthProc); 192 Code_t ZLocateUser(char *, int *, Z_AuthProc);
192 Code_t ZRequestLocations(const char *, ZAsyncLocateData_t *, ZNotice_Kind_t, 193 Code_t ZRequestLocations(const char *, ZAsyncLocateData_t *, ZNotice_Kind_t,
193 Z_AuthProc); 194 Z_AuthProc);
194 Code_t ZhmStat(struct in_addr *, ZNotice_t *); 195 Code_t ZhmStat(ZNotice_t *);
195 Code_t ZInitialize(void); 196 Code_t ZInitialize(void);
196 Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *); 197 Code_t ZFormatSmallRawNotice(ZNotice_t *, ZPacket_t, int *);
197 int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *); 198 int ZCompareUID(ZUnique_Id_t *, ZUnique_Id_t *);
198 Code_t ZMakeAscii(char *, int, unsigned char *, int); 199 Code_t ZMakeAscii(char *, int, unsigned char *, int);
199 Code_t ZMakeAscii32(char *, int, unsigned long); 200 Code_t ZMakeAscii32(char *, int, unsigned long);
200 Code_t ZMakeAscii16(char *, int, unsigned int); 201 Code_t ZMakeAscii16(char *, int, unsigned int);
201 Code_t ZReceivePacket(ZPacket_t, int *, struct sockaddr_in *); 202 Code_t ZReceivePacket(ZPacket_t, int *, GSocketAddress **);
202 Code_t ZCheckAuthentication(ZNotice_t *, struct sockaddr_in *); 203 Code_t ZCheckAuthentication(ZNotice_t *);
203 Code_t ZSetLocation(char *exposure); 204 Code_t ZSetLocation(char *exposure);
204 Code_t ZUnsetLocation(void); 205 Code_t ZUnsetLocation(void);
205 Code_t ZFlushMyLocations(void); 206 Code_t ZFlushMyLocations(void);
206 Code_t ZFormatRawNotice(ZNotice_t *, char **, int *); 207 Code_t ZFormatRawNotice(ZNotice_t *, char **, int *);
207 Code_t ZRetrieveSubscriptions(unsigned short, int *); 208 Code_t ZRetrieveSubscriptions(unsigned short, int *);
213 Code_t ZParseLocations(register ZNotice_t *notice, 214 Code_t ZParseLocations(register ZNotice_t *notice,
214 register ZAsyncLocateData_t *zald, int *nlocs, 215 register ZAsyncLocateData_t *zald, int *nlocs,
215 char **user); 216 char **user);
216 int ZCompareALDPred(ZNotice_t *notice, void *zald); 217 int ZCompareALDPred(ZNotice_t *notice, void *zald);
217 void ZFreeALD(register ZAsyncLocateData_t *zald); 218 void ZFreeALD(register ZAsyncLocateData_t *zald);
218 Code_t ZCheckIfNotice(ZNotice_t *notice, struct sockaddr_in *from, 219 Code_t ZCheckIfNotice(ZNotice_t *notice, GSocketAddress **from,
219 register int (*predicate)(ZNotice_t *, void *), 220 register int (*predicate)(ZNotice_t *, void *),
220 void *args); 221 void *args);
221 Code_t ZPeekPacket(char **buffer, int *ret_len, struct sockaddr_in *from); 222 Code_t ZPeekPacket(char **buffer, int *ret_len, GSocketAddress **from);
222 Code_t ZPeekNotice(ZNotice_t *notice, struct sockaddr_in *from); 223 Code_t ZPeekNotice(ZNotice_t *notice, GSocketAddress **from);
223 Code_t ZIfNotice(ZNotice_t *notice, struct sockaddr_in *from, 224 Code_t ZIfNotice(ZNotice_t *notice, GSocketAddress **from,
224 int (*predicate)(ZNotice_t *, void *), void *args); 225 int (*predicate)(ZNotice_t *, void *), void *args);
225 Code_t ZSubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port); 226 Code_t ZSubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port);
226 Code_t ZSubscribeToSansDefaults(ZSubscription_t *sublist, int nitems, 227 Code_t ZSubscribeToSansDefaults(ZSubscription_t *sublist, int nitems,
227 unsigned int port); 228 unsigned int port);
228 Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port); 229 Code_t ZUnsubscribeTo(ZSubscription_t *sublist, int nitems, unsigned int port);
229 Code_t ZCancelSubscriptions(unsigned int port); 230 Code_t ZCancelSubscriptions(unsigned int port);
230 int ZPending(void); 231 int ZPending(void);
231 Code_t ZReceiveNotice(ZNotice_t *notice, struct sockaddr_in *from); 232 Code_t ZReceiveNotice(ZNotice_t *notice, GSocketAddress **from);
232 233
233 typedef Code_t (*Z_SendProc)(ZNotice_t *, char *, int, int); 234 typedef Code_t (*Z_SendProc)(ZNotice_t *, char *, int, int);
234 235
235 Z_InputQ *Z_GetFirstComplete(void); 236 Z_InputQ *Z_GetFirstComplete(void);
236 Z_InputQ *Z_GetNextComplete(Z_InputQ *); 237 Z_InputQ *Z_GetNextComplete(Z_InputQ *);
257 258
258 extern ZSubscription_t *__subscriptions_list; 259 extern ZSubscription_t *__subscriptions_list;
259 extern int __subscriptions_num; 260 extern int __subscriptions_num;
260 extern int __subscriptions_next; 261 extern int __subscriptions_next;
261 262
262 extern int __Zephyr_port; /* Port number */ 263 extern gint __Zephyr_port; /* Port number */
263 extern struct in_addr __My_addr; 264 extern guint32 __My_addr;
264 265
265 /* Macros to retrieve Zephyr library values. */ 266 /* Macros to retrieve Zephyr library values. */
266 extern int __Zephyr_fd; 267 extern GSocket *__Zephyr_socket;
267 extern int __Q_CompleteLength; 268 extern int __Q_CompleteLength;
268 extern struct sockaddr_in __HM_addr; 269 extern GSocketAddress *__HM_addr;
269 extern char __Zephyr_realm[]; 270 extern char __Zephyr_realm[];
270 #define ZGetFD() __Zephyr_fd 271 #define ZGetSocket() __Zephyr_socket
271 #define ZQLength() __Q_CompleteLength 272 #define ZQLength() __Q_CompleteLength
272 #define ZGetDestAddr() __HM_addr 273 #define ZGetDestAddr() __HM_addr
273 #define ZGetRealm() __Zephyr_realm 274 #define ZGetRealm() __Zephyr_realm
274 275
275 /* Maximum queue length */ 276 /* Maximum queue length */

mercurial