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