xref: /csrg-svn/sys/netinet/in_systm.h (revision 4923)
1*4923Swnj /* in_systm.h 4.4 81/11/18 */
24806Swnj 
34806Swnj /*
44806Swnj  * Miscellaneous internetwork
54806Swnj  * definitions for kernel.
64806Swnj  */
74806Swnj 
84806Swnj /*
94806Swnj  * Network types.
104806Swnj  *
114806Swnj  * Internally the system keeps counters in the headers with the bytes
124806Swnj  * swapped so that VAX instructions will work on them.  It reverses
134806Swnj  * the bytes before transmission at each protocol level.  The n_ types
144806Swnj  * represent the types with the bytes in ``high-ender'' order.
154806Swnj  */
164806Swnj typedef u_short n_short;		/* short as received from the net */
174806Swnj typedef u_long	n_long;			/* long as received from the net */
184806Swnj typedef u_long	seq_t;			/* sequence number */
194806Swnj 
204806Swnj typedef	u_long	n_time;			/* ms since 00:00 GMT, byte rev */
214806Swnj 
224806Swnj /*
234806Swnj  * The network runs as a software interrupt process.
244806Swnj  * You can switch into the network by doing splnet() and return by splx().
254806Swnj  * The software interrupt level for the network is higher than the software
264806Swnj  * level for the clock (so you can enter the network in routines called
274806Swnj  * at timeout time).  Splimp is an ipl high enough to block all imps.
28*4923Swnj  * While manipulating the mbuf buffer pool you have to block imps.
294806Swnj  */
304806Swnj #define	splimp		spl5
314806Swnj #define	setsoftnet()	mtpr(SIRR, 12)
324806Swnj /* splnet is defined in ../sys/asm.sed */
334806Swnj 
344806Swnj /*
354806Swnj  * Network statistics record.
364806Swnj  *
374806Swnj  * SHOULD BE KEPT PER INTERFACE, AND WITH CNT, RATE, SUM.
384806Swnj  */
394806Swnj struct	net_stat {
404806Swnj 	int	imp_resets;		/* # times imp reset */
414806Swnj 	int	imp_flushes;		/* # packets flushed by imp */
424806Swnj 	int	imp_drops;		/* # msgs from imp no-one wants */
434806Swnj 	int	m_drops;		/* # mbuf drops from lack of bufs */
444806Swnj 	int	ip_badsum;		/* # bad ip checksums */
454806Swnj 	int	t_badsum;		/* # bad tcp checksums */
464806Swnj 	int	t_badsegs;		/* # bad tcp segments */
474806Swnj 	int	t_unack;		/* # tcp segs placed on rcv_unack */
484806Swnj };
494806Swnj 
504806Swnj #ifdef	KERNEL
51*4923Swnj n_time	iptime();
524806Swnj #endif
534806Swnj 
544806Swnj #ifdef KPROF
554806Swnj #include "../inet/count.h"
564806Swnj #define	COUNT(i)	nrcount[i]++
574806Swnj int	nrcount[NCOUNTERS+1];
584806Swnj #else
594806Swnj #define	COUNT(i)
604806Swnj #endif
61