xref: /original-bsd/sys/netinet/in_systm.h (revision fbed46ce)
1 /*	in_systm.h	4.10	82/04/20	*/
2 
3 /*
4  * Miscellaneous internetwork
5  * definitions for kernel.
6  */
7 
8 #ifndef LOCORE
9 /*
10  * Network types.
11  *
12  * Internally the system keeps counters in the headers with the bytes
13  * swapped so that VAX instructions will work on them.  It reverses
14  * the bytes before transmission at each protocol level.  The n_ types
15  * represent the types with the bytes in ``high-ender'' order.
16  */
17 typedef u_short n_short;		/* short as received from the net */
18 typedef u_long	n_long;			/* long as received from the net */
19 
20 typedef	u_long	n_time;			/* ms since 00:00 GMT, byte rev */
21 #endif
22 
23 /*
24  * The internet code runs off software interrupts.
25  *
26  * You can switch into the network by doing splnet() and return by splx().
27  * The software interrupt level for the network is higher than the software
28  * level for the clock (so you can enter the network in routines called
29  * at timeout time).  Splimp is an ipl high enough to block all imps.
30  * While manipulating the mbuf buffer pool you have to block imps.
31  */
32 
33 /* splnet is defined in ../sys/asm.sed */
34 #ifdef ECHACK
35 #define	splimp		spl6
36 #else
37 #define	splimp		spl5
38 #endif
39 #define	setsoftnet()	mtpr(SIRR, 12)
40 
41 /*
42  * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
43  * word which is used to de-multiplex a single software
44  * interrupt used for scheduling the network code to calls
45  * on the lowest level routine of each protocol.
46  */
47 #define	NETISR_RAW	0		/* same as AF_UNSPEC */
48 #define	NETISR_IP	2		/* same as AF_INET */
49 #define	NETISR_NS	6		/* same as AF_NS */
50 
51 #define	schednetisr(anisr)	{ netisr |= 1<<(anisr); setsoftnet(); }
52 
53 #ifndef LOCORE
54 #ifdef KERNEL
55 int	netisr;				/* scheduling bits for network */
56 #endif
57 
58 
59 #ifdef	KERNEL
60 n_time	iptime();
61 #endif
62 
63 #ifdef KPROF
64 #include "../inet/count.h"
65 #define	COUNT(i)	nrcount[i]++
66 int	nrcount[NCOUNTERS+1];
67 #else
68 #define	COUNT(i)
69 #endif
70 #endif
71