xref: /csrg-svn/sys/netiso/tuba_table.h (revision 56903)
1 /*-
2  * Copyright (c) 1992 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)tuba_table.h	7.8 (Berkeley) 11/20/92
8  */
9 
10 struct tuba_cache {
11 	struct	radix_node tc_nodes[2];		/* convenient lookup */
12 	int	tc_refcnt;
13 	int	tc_time;			/* last looked up */
14 	int	tc_flags;
15 #define TCF_PERM	1
16 	int	tc_index;
17 	u_short	tc_sum;				/* cksum of nsap inc. length */
18 	u_short	tc_ssum;			/* swab(tc_sum) */
19 	struct	sockaddr_iso tc_siso;		/* for responding */
20 };
21 
22 #define ADDCARRY(x)  (x >= 65535 ? x -= 65535 : x)
23 #define REDUCE(a, b) { union { u_short s[2]; long l;} l_util; long x; \
24 	l_util.l = (b); x = l_util.s[0] + l_util.s[1]; ADDCARRY(x); \
25 	if (x == 0) x = 0xffff; a = x;}
26 #define SWAB(a, b) { union { u_char c[2]; u_short s;} s_util; u_short x; \
27 	u_char t; s_util.s = b; t = c[0]; c[0] = c[1]; c[1] = t; }
28 
29 #ifdef KERNEL
30 extern int	tuba_table_size;
31 extern struct	tuba_cache **tuba_table;
32 extern struct	radix_node_head *tuba_tree;
33 #endif
34