| |
1 |
| |
2 #ifndef __INTERNAL_H__ |
| |
3 #define __INTERNAL_H__ |
| |
4 |
| |
5 #include <sysdep.h> |
| |
6 #include <zephyr/zephyr.h> |
| |
7 #include <netdb.h> |
| |
8 |
| |
9 #ifdef ZEPHYR_USES_HESIOD |
| |
10 #include <hesiod.h> |
| |
11 #endif |
| |
12 |
| |
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 |
| |
19 |
| |
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) |
| |
23 |
| |
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 */ |
| |
32 |
| |
33 struct _Z_Hole { |
| |
34 struct _Z_Hole *next; |
| |
35 int first; |
| |
36 int last; |
| |
37 }; |
| |
38 |
| |
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; |
| |
55 }; |
| |
56 |
| |
57 extern struct _Z_InputQ *__Q_Head, *__Q_Tail; |
| |
58 |
| |
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 */ |
| |
62 |
| |
63 extern ZLocations_t *__locate_list; |
| |
64 extern int __locate_num; |
| |
65 extern int __locate_next; |
| |
66 |
| |
67 extern ZSubscription_t *__subscriptions_list; |
| |
68 extern int __subscriptions_num; |
| |
69 extern int __subscriptions_next; |
| |
70 |
| |
71 extern int __Zephyr_port; /* Port number */ |
| |
72 |
| |
73 typedef Code_t (*Z_SendProc) __P((ZNotice_t *, char *, int, int)); |
| |
74 |
| |
75 struct _Z_InputQ *Z_GetFirstComplete __P((void)); |
| |
76 struct _Z_InputQ *Z_GetNextComplete __P((struct _Z_InputQ *)); |
| |
77 Code_t Z_XmitFragment __P((ZNotice_t*, char *,int,int)); |
| |
78 void Z_RemQueue __P((struct _Z_InputQ *)); |
| |
79 Code_t Z_AddNoticeToEntry __P((struct _Z_InputQ*, ZNotice_t*, int)); |
| |
80 Code_t Z_FormatAuthHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); |
| |
81 Code_t Z_FormatHeader __P((ZNotice_t *, char *, int, int *, Z_AuthProc)); |
| |
82 Code_t Z_FormatRawHeader __P((ZNotice_t *, char*, int, |
| |
83 int*, char **, char **)); |
| |
84 Code_t Z_ReadEnqueue __P((void)); |
| |
85 Code_t Z_ReadWait __P((void)); |
| |
86 Code_t Z_SendLocation __P((char*, char*, Z_AuthProc, char*)); |
| |
87 Code_t Z_SendFragmentedNotice __P((ZNotice_t *notice, int len, |
| |
88 Z_AuthProc cert_func, |
| |
89 Z_SendProc send_func)); |
| |
90 Code_t Z_WaitForComplete __P((void)); |
| |
91 Code_t Z_WaitForNotice __P((ZNotice_t *notice, |
| |
92 int (*pred) __P((ZNotice_t *, void *)), void *arg, |
| |
93 int timeout)); |
| |
94 |
| |
95 #endif /* __INTERNAL_H__ */ |
| |
96 |