xref: /csrg-svn/sys/netinet/in_systm.h (revision 4923)
1 /* in_systm.h 4.4 81/11/18 */
2 
3 /*
4  * Miscellaneous internetwork
5  * definitions for kernel.
6  */
7 
8 /*
9  * Network types.
10  *
11  * Internally the system keeps counters in the headers with the bytes
12  * swapped so that VAX instructions will work on them.  It reverses
13  * the bytes before transmission at each protocol level.  The n_ types
14  * represent the types with the bytes in ``high-ender'' order.
15  */
16 typedef u_short n_short;		/* short as received from the net */
17 typedef u_long	n_long;			/* long as received from the net */
18 typedef u_long	seq_t;			/* sequence number */
19 
20 typedef	u_long	n_time;			/* ms since 00:00 GMT, byte rev */
21 
22 /*
23  * The network runs as a software interrupt process.
24  * You can switch into the network by doing splnet() and return by splx().
25  * The software interrupt level for the network is higher than the software
26  * level for the clock (so you can enter the network in routines called
27  * at timeout time).  Splimp is an ipl high enough to block all imps.
28  * While manipulating the mbuf buffer pool you have to block imps.
29  */
30 #define	splimp		spl5
31 #define	setsoftnet()	mtpr(SIRR, 12)
32 /* splnet is defined in ../sys/asm.sed */
33 
34 /*
35  * Network statistics record.
36  *
37  * SHOULD BE KEPT PER INTERFACE, AND WITH CNT, RATE, SUM.
38  */
39 struct	net_stat {
40 	int	imp_resets;		/* # times imp reset */
41 	int	imp_flushes;		/* # packets flushed by imp */
42 	int	imp_drops;		/* # msgs from imp no-one wants */
43 	int	m_drops;		/* # mbuf drops from lack of bufs */
44 	int	ip_badsum;		/* # bad ip checksums */
45 	int	t_badsum;		/* # bad tcp checksums */
46 	int	t_badsegs;		/* # bad tcp segments */
47 	int	t_unack;		/* # tcp segs placed on rcv_unack */
48 };
49 
50 #ifdef	KERNEL
51 n_time	iptime();
52 #endif
53 
54 #ifdef KPROF
55 #include "../inet/count.h"
56 #define	COUNT(i)	nrcount[i]++
57 int	nrcount[NCOUNTERS+1];
58 #else
59 #define	COUNT(i)
60 #endif
61