Migrate certificates, icons, logs to XDG dirs
[pidgin-git.git] / libpurple / protocols / zephyr / internal.h
blob0a0648d88a4423b1550a469fa27e4dc3b37c68f5
1 #ifndef __INTERNAL_H__
2 #define __INTERNAL_H__
4 #include <sysdep.h>
6 #ifdef LIBZEPHYR_EXT
7 #include <zephyr/zephyr.h>
8 #else
9 #include <zephyr_internal.h>
10 #endif
12 #ifndef WIN32
13 #include <netdb.h>
14 #endif
18 #ifdef WIN32
20 #ifndef MAXHOSTNAMELEN
21 #define MAXHOSTNAMELEN 512
22 #endif
24 #define ETIMEDOUT WSAETIMEDOUT
25 #define EADDRINUSE WSAEADDRINUSE
26 #else /* !WIN32 */
28 #ifndef MAXHOSTNAMELEN
29 #define MAXHOSTNAMELEN 4096
30 #endif
32 #endif
34 #ifdef ZEPHYR_USES_HESIOD
35 #include <hesiod.h>
36 #endif
38 #ifndef ZEPHYR_USES_KERBEROS
39 #define REALM_SZ MAXHOSTNAMELEN
40 #define INST_SZ 0 /* no instances w/o Kerberos */
41 #define ANAME_SZ 9 /* size of a username + null */
42 #define CLOCK_SKEW 300 /* max time to cache packet ids */
43 #endif
45 #define SERVER_SVC_FALLBACK htons((unsigned short) 2103)
46 #define HM_SVC_FALLBACK htons((unsigned short) 2104)
47 #define HM_SRV_SVC_FALLBACK htons((unsigned short) 2105)
49 #define ZAUTH_CKSUM_FAILED (-2) /* Used only by server. */
50 #define ZAUTH_UNSET (-3) /* Internal to client library. */
51 #define Z_MAXFRAGS 500 /* Max number of packet fragments */
52 #define Z_MAXNOTICESIZE 400000 /* Max size of incoming notice */
53 #define Z_MAXQUEUESIZE 1500000 /* Max size of input queue notices */
54 #define Z_FRAGFUDGE 13 /* Room to for multinotice field */
55 #define Z_NOTICETIMELIMIT 30 /* Time to wait for fragments */
56 #define Z_INITFILTERSIZE 30 /* Starting size of uid filter */
58 struct _Z_Hole {
59 struct _Z_Hole *next;
60 int first;
61 int last;
64 struct _Z_InputQ {
65 struct _Z_InputQ *next;
66 struct _Z_InputQ *prev;
67 ZNotice_Kind_t kind;
68 unsigned ZEPHYR_INT32 timep;
69 int packet_len;
70 char *packet;
71 int complete;
72 struct sockaddr_in from;
73 struct _Z_Hole *holelist;
74 ZUnique_Id_t uid;
75 int auth;
76 int header_len;
77 char *header;
78 int msg_len;
79 char *msg;
82 extern struct _Z_InputQ *__Q_Head, *__Q_Tail;
84 extern int __Zephyr_open; /* 0 if FD opened, 1 otherwise */
85 extern int __HM_set; /* 0 if dest addr set, 1 otherwise */
86 extern int __Zephyr_server; /* 0 if normal client, 1 if server or zhm */
88 extern ZLocations_t *__locate_list;
89 extern int __locate_num;
90 extern int __locate_next;
92 extern ZSubscription_t *__subscriptions_list;
93 extern int __subscriptions_num;
94 extern int __subscriptions_next;
96 extern int __Zephyr_port; /* Port number */
97 extern struct in_addr __My_addr;
99 typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int));
101 struct _Z_InputQ *Z_GetFirstComplete __P((void));
102 struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *));
103 Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int));
104 void Z_RemQueue __P((struct _Z_InputQ *));
105 Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int));
106 Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc));
107 Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc));
108 Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, gsize,
109 int*, char **, char **));
110 Code_t Z_ReadEnqueue __P((void));
111 Code_t Z_ReadWait __P((void));
112 Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*));
113 Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len,
114 Z_AuthProc cert_func,
115 Z_SendProc send_func));
116 Code_t Z_WaitForComplete __P((void));
117 Code_t Z_WaitForNotice __P((ZNotice_t *notice,
118 int (*pred) __P((ZNotice_t *, void *)), void *arg,
119 int timeout));
121 #endif /* __INTERNAL_H__ */