summaryrefslogtreecommitdiff
path: root/h/zephyr/zephyr_internal.h
blob: 265af554d8138ad322b3ae5e01e8e9897ff78477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* This file is part of the Project Athena Zephyr Notification System.
 * It contains internal definitions for the client library.
 *
 *	Created by:	Robert French
 *
 *	$Source$
 *	$Author$
 *
 *	Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
 *	For copying and distribution information, see the file
 *	"mit-copyright.h". 
 */
/* $Header$ */

#ifndef __ZINTERNAL_H__
#define __ZINTERNAL_H__

#include <zephyr/zephyr.h>
#include <strings.h>			/* for strcpy, etc. */
#include <sys/types.h>			/* for time_t, uid_t, etc */
#ifdef lint
#include <sys/uio.h>			/* to make lint shut up about
					   struct/union iovec */
#endif /* lint */

struct _Z_Hole {
    struct _Z_Hole	*next;
    int			first;
    int			last;
};

struct _Z_InputQ {
    struct _Z_InputQ	*next;
    struct _Z_InputQ	*prev;
    ZNotice_Kind_t	kind;
    unsigned long	timep;
    int			packet_len;
    char		*packet;
    int			complete;
    struct sockaddr_in	from;
    struct _Z_Hole	*holelist;
    ZUnique_Id_t	uid;
    int			header_len;
    char		*header;
    int			msg_len;
    char		*msg;
};

extern struct _Z_InputQ *__Q_Head, *__Q_Tail;

	/* Maximum number of packet fragments */
#define Z_MAXFRAGS		500	/* Probably around 350K */

	/* Maximum allowable size of an incoming notice */
#define Z_MAXNOTICESIZE		400000

	/* Maximum allowable size of all notices in the input queue */
	/* This is more of a ballpark figure than a hard limit */
#define Z_MAXQUEUESIZE		1500000

	/* Amount of room to leave for multinotice field */
#define Z_FRAGFUDGE		13	/* 999999/999999 */

	/* Amount of time a notice can stay in the queue without being
	 * touched by an incoming fragment */
#define Z_NOTICETIMELIMIT	30	/* seconds */

	/* Number of old uid's to keep around to help filter out duplicates */
#define Z_FILTERDEPTH		10	/* uid's */

extern int __Zephyr_open; /* 0 if the library opened the FD, 1 otherwise */
extern int __HM_set; /* 0 if the library set the dest addr, 1 otherwise */
extern int __Zephyr_server; /* 0 if normal client, 1 if server */

extern ZLocations_t *__locate_list;
extern int __locate_num;
extern int __locate_next;

extern ZSubscription_t *__subscriptions_list;
extern int __subscriptions_num;
extern int __subscriptions_next;

#ifdef Z_HaveKerberos
extern int krb_err_base;
#endif

#ifdef NO_MALLOC_ZERO
#ifdef __STDC__
extern void * (*Z_malloc) ();
#else
extern char * (*Z_malloc) ();
#endif
#undef malloc
#define malloc(N) ((*Z_malloc)(N))
#endif

#ifdef __cplusplus
extern "C" {
#endif

#ifndef NO_MALLOC_ZERO
#if defined(__STDC__) || defined(__cplusplus)
    extern void *malloc (unsigned);
#else
    extern char *malloc();
#endif
#endif
    extern time_t time Zproto((time_t *));
    extern long random();

    extern struct _Z_InputQ *Z_GetFirstComplete();
    extern struct _Z_InputQ *Z_GetNextComplete();
    extern Code_t Z_XmitFragment Zproto((ZNotice_t*, char *,int,int));
    extern void Z_RemQueue Zproto ((struct _Z_InputQ *));

#ifdef __cplusplus
}
#endif

#endif /* !__ZINTERNAL_H__ */