xref: /csrg-svn/sys/net/if.h (revision 5083)
1 /*	if.h	4.3	81/11/26	*/
2 
3 /*
4  * Definitions for network interfaces.
5  */
6 struct ifqueue {
7 	struct	mbuf *ifq_head;
8 	struct	mbuf *ifq_tail;
9 };
10 
11 /*
12  * Structure defining a queue for a network interface.
13  *
14  * (Would like to call this struct ``if'', but C isn't PL/1.)
15  */
16 struct ifnet {
17 	short	if_unit;		/* sub-unit for lower level driver */
18 	short	if_mtu;			/* maximum transmission unit */
19 	short	if_net;			/* network number of interface */
20 	int	if_host[2];		/* local net host number */
21 	struct	in_addr if_addr;	/* internet address of interface */
22 	struct	ifqueue if_snd;		/* output queue */
23 	int	(*if_output)();		/* output routine */
24 	int	(*if_ubareset)();	/* uba reset routine */
25 	int	if_collisions;
26 	int	if_ierrors;
27 	int	if_oerrors;
28 	struct	ifnet *if_next;
29 };
30 
31 #define	IF_ENQUEUE(ifq, m) { \
32 	(m)->m_act = 0; \
33 	if ((ifq)->ifq_tail == 0) \
34 		(ifq)->ifq_head = (ifq)->ifq_tail =  m; \
35 	else \
36 		(ifq)->ifq_tail->m_act = m; \
37 }
38 #define	IF_DEQUEUE(ifq, m) { \
39 	(m) = (ifq)->ifq_head; \
40 	if (m) { \
41 		if (((ifq)->ifq_head = (m)->m_act) == 0) \
42 			(ifq)->ifq_tail = 0; \
43 		(m)->m_act = 0; \
44 	} \
45 }
46 
47 #ifdef KERNEL
48 #ifdef INET
49 struct	ifqueue	ipintrq;		/* ip packet input queue */
50 #endif
51 struct	ifnet *ifnet;
52 struct	ifnet *if_ifwithaddr(), *if_ifonnetof(), *if_gatewayfor();
53 #endif
54