[gaim-migrate @ 3063]
[pidgin-git.git] / src / protocols / zephyr / internal.h
blob6c2b577f488dd89194bbbc3ff2e3911bf94f5a97
2 #ifndef __INTERNAL_H__
3 #define __INTERNAL_H__
5 #include <sysdep.h>
6 #include <zephyr/zephyr.h>
7 #include <netdb.h>
9 #ifdef ZEPHYR_USES_HESIOD
10 #include <hesiod.h>
11 #endif
13 #ifndef ZEPHYR_USES_KERBEROS
14 #define REALM_SZ MAXHOSTNAMELEN
15 #define INST_SZ 0 /* no instances w/o Kerberos */
16 #define ANAME_SZ 9 /* size of a username + null */
17 #define CLOCK_SKEW 300 /* max time to cache packet ids */
18 #endif
20 #define SERVER_SVC_FALLBACK htons((unsigned short) 2103)
21 #define HM_SVC_FALLBACK htons((unsigned short) 2104)
22 #define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105)
24 #define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */
25 #define ZAUTH_UNSET (-3) /* Internal to client library. */
26 #define Z_MAXFRAGS 500 /* Max number of packet fragments */
27 #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */
28 #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */
29 #define Z_FRAGFUDGE 13 /* Room to for multinotice field */
30 #define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */
31 #define Z_INITFILTERSIZE 30 /* Starting size of uid filter */
33 struct _Z_Hole {
34 struct _Z_Hole *next;
35 int first;
36 int last;
39 struct _Z_InputQ {
40 struct _Z_InputQ *next;
41 struct _Z_InputQ *prev;
42 ZNotice_Kind_t kind;
43 unsigned ZEPHYR_INT32 timep;
44 int packet_len;
45 char *packet;
46 int complete;
47 struct sockaddr_in from;
48 struct _Z_Hole *holelist;
49 ZUnique_Id_t uid;
50 int auth;
51 int header_len;
52 char *header;
53 int msg_len;
54 char *msg;
57 extern struct _Z_InputQ *__Q_Head, *__Q_Tail;
59 extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */
60 extern int __HM_set; /* 0 if dest addr set, 1 otherwise */
61 extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */
63 extern ZLocations_t *__locate_list;
64 extern int __locate_num;
65 extern int __locate_next;
67 extern ZSubscription_t *__subscriptions_list;
68 extern int __subscriptions_num;
69 extern int __subscriptions_next;
71 extern int __Zephyr_port; /* Port number */
72 extern struct in_addr __My_addr;
74 typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int));
76 struct _Z_InputQ *Z_GetFirstComplete __P((void));
77 struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *));
78 Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int));
79 void Z_RemQueue __P((struct _Z_InputQ *));
80 Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int));
81 Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc));
82 Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc));
83 Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int,
84 int*, char **, char **));
85 Code_t Z_ReadEnqueue __P((void));
86 Code_t Z_ReadWait __P((void));
87 Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*));
88 Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len,
89 Z_AuthProc cert_func,
90 Z_SendProc send_func));
91 Code_t Z_WaitForComplete __P((void));
92 Code_t Z_WaitForNotice __P((ZNotice_t *notice,
93 int (*pred) __P((ZNotice_t *, void *)), void *arg,
94 int timeout));
96 #endif /* __INTERNAL_H__ */