-/* if.h 4.10 82/03/19 */
+/* if.h 4.16 82/10/31 */
/*
* Structures defining a network interface, providing a packet
* received from its medium.
*
* Output occurs when the routine if_output is called, with three parameters:
- * (*ifp->if_output)(ifp, m, pf)
- * Here m is the mbuf chain to be sent and pf is the protocol family
- * of the internetwork datagram format in which the data is wrapped
- * (e.g. PF_PUP or PF_INET). The output routine encapsulates the
- * supplied datagram if necessary, and then transmits it on its medium.
+ * (*ifp->if_output)(ifp, m, dst)
+ * Here m is the mbuf chain to be sent and dst is the destination address.
+ * The output routine encapsulates the supplied datagram if necessary,
+ * and then transmits it on its medium.
*
* On input, each interface unwraps the data received by it, and either
* places it on the input queue of a internetwork datagram routine
* and posts the associated software interrupt, or passes the datagram to a raw
* packet input routine.
*
- * Routines exist for locating interfaces by their internet addresses
+ * Routines exist for locating interfaces by their addresses
* or for locating a interface on a certain network, as well as more general
* routing and gateway routines maintaining information used to locate
- * interfaces. These routines live in the files if.c and ip_ggp.c.
+ * interfaces. These routines live in the files if.c and route.c
*/
/*
* Structure defining a queue for a network interface.
*
* (Would like to call this struct ``if'', but C isn't PL/1.)
+ *
+ * EVENTUALLY PURGE if_net AND if_host FROM STRUCTURE
*/
struct ifnet {
char *if_name; /* name, e.g. ``en'' or ``lo'' */
short if_unit; /* sub-unit for lower level driver */
short if_mtu; /* maximum transmission unit */
- short if_net; /* network number of interface */
+ int if_net; /* network number of interface */
+ short if_flags; /* up/down, broadcast, etc. */
+ short if_timer; /* time 'til if_watchdog called */
int if_host[2]; /* local net host number */
- struct in_addr if_addr; /* internet address of interface */
- struct in_addr if_broadaddr; /* broadcast address of interface */
+ struct sockaddr if_addr; /* address of interface */
+ union {
+ struct sockaddr ifu_broadaddr;
+ struct sockaddr ifu_dstaddr;
+ } if_ifu;
+#define if_broadaddr if_ifu.ifu_broadaddr /* broadcast address */
+#define if_dstaddr if_ifu.ifu_dstaddr /* other end of p-to-p link */
struct ifqueue {
struct mbuf *ifq_head;
struct mbuf *ifq_tail;
/* procedure handles */
int (*if_init)(); /* init routine */
int (*if_output)(); /* output routine */
- int (*if_ubareset)(); /* uba reset routine */
+ int (*if_reset)(); /* bus reset routine */
+ int (*if_watchdog)(); /* timer routine */
/* generic interface statistics */
int if_ipackets; /* packets received on interface */
int if_ierrors; /* input errors on interface */
struct ifnet *if_next;
};
+#define IFF_UP 0x1 /* interface is up */
+#define IFF_BROADCAST 0x2 /* broadcast address valid */
+#define IFF_DEBUG 0x4 /* turn on debugging */
+#define IFF_ROUTE 0x8 /* routing entry installed */
+#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
+
/*
* Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
* input routines have queues of messages stored on ifqueue structures
}
#define IFQ_MAXLEN 50
+#define IFNET_SLOWHZ 1 /* granularity is 1 second */
#ifdef KERNEL
-struct ifqueue rawintrq; /* raw packet input queue */
#ifdef INET
struct ifqueue ipintrq; /* ip packet input queue */
#endif
+struct ifqueue rawintrq; /* raw packet input queue */
struct ifnet *ifnet;
-struct ifnet *if_ifwithaddr(), *if_ifonnetof(), *if_gatewayfor();
+struct ifnet *if_ifwithaddr(), *if_ifwithnet(), *if_ifwithaf();
+struct ifnet *if_ifonnetof();
struct in_addr if_makeaddr();
#endif