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