handle routing redirects, albeit simplisticly
[unix-history] / usr / src / sys / net / if.h
index 067db3f..fd639ff 100644 (file)
@@ -1,4 +1,4 @@
-/*     if.h    4.10    82/03/19        */
+/*     if.h    4.16    82/10/31        */
 
 /*
  * Structures defining a network interface, providing a packet
 
 /*
  * Structures defining a network interface, providing a packet
@@ -9,36 +9,44 @@
  * received from its medium.
  *
  * Output occurs when the routine if_output is called, with three parameters:
  * 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.
  *
  *
  * 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
  * 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.)
  */
 
 /*
  * 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 */
  */
 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 */
        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;
        struct  ifqueue {
                struct  mbuf *ifq_head;
                struct  mbuf *ifq_tail;
@@ -49,7 +57,8 @@ struct ifnet {
 /* procedure handles */
        int     (*if_init)();           /* init routine */
        int     (*if_output)();         /* output routine */
 /* 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 */
 /* generic interface statistics */
        int     if_ipackets;            /* packets received on interface */
        int     if_ierrors;             /* input errors on interface */
@@ -60,6 +69,12 @@ struct ifnet {
        struct  ifnet *if_next;
 };
 
        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
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
  * input routines have queues of messages stored on ifqueue structures
@@ -95,13 +110,15 @@ struct ifnet {
 }
 
 #define        IFQ_MAXLEN      50
 }
 
 #define        IFQ_MAXLEN      50
+#define        IFNET_SLOWHZ    1               /* granularity is 1 second */
 
 #ifdef KERNEL
 
 #ifdef KERNEL
-struct ifqueue rawintrq;               /* raw packet input queue */
 #ifdef INET
 struct ifqueue ipintrq;                /* ip packet input queue */
 #endif
 #ifdef INET
 struct ifqueue ipintrq;                /* ip packet input queue */
 #endif
+struct ifqueue rawintrq;               /* raw packet input queue */
 struct ifnet *ifnet;
 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
 struct in_addr if_makeaddr();
 #endif