This commit was generated by cvs2svn to track changes on a CVS vendor
[unix-history] / sys / net / if.h
index 30928d1..4dbcc42 100644 (file)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)if.h        7.11 (Berkeley) 3/19/91
+ *     from: @(#)if.h  7.11 (Berkeley) 3/19/91
+ *     $Id: if.h,v 1.10 1993/11/25 01:33:59 wollman Exp $
  */
 
  */
 
+#ifndef _NET_IF_H_
+#define _NET_IF_H_ 1
+
 /*
  * Structures defining a network interface, providing a packet
  * transport mechanism (ala level 0 of the PUP protocols).
 /*
  * Structures defining a network interface, providing a packet
  * transport mechanism (ala level 0 of the PUP protocols).
  * (Would like to call this struct ``if'', but C isn't PL/1.)
  */
 
  * (Would like to call this struct ``if'', but C isn't PL/1.)
  */
 
+struct rtentry;
+
 struct ifnet {
        char    *if_name;               /* name, e.g. ``en'' or ``lo'' */
        short   if_unit;                /* sub-unit for lower level driver */
 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_oflags;              /* up/down, broadcast, etc. */
+       u_short if_mtu;                 /* maximum transmission unit */
+       short   if_flags;               /* up/down, broadcast, etc. */
        short   if_timer;               /* time 'til if_watchdog called */
        int     if_metric;              /* routing metric (external only) */
        struct  ifaddr *if_addrlist;    /* linked list of addresses per if */
        short   if_timer;               /* time 'til if_watchdog called */
        int     if_metric;              /* routing metric (external only) */
        struct  ifaddr *if_addrlist;    /* linked list of addresses per if */
@@ -87,13 +93,14 @@ struct ifnet {
                int     ifq_drops;
        } if_snd;                       /* output queue */
 /* procedure handles */
                int     ifq_drops;
        } if_snd;                       /* output queue */
 /* procedure handles */
-       int     (*if_init)();           /* init routine */
-       int     (*if_output)();         /* output routine (enqueue) */
-       int     (*if_start)();          /* initiate output routine */
-       int     (*if_done)();           /* output complete routine */
-       int     (*if_ioctl)();          /* ioctl routine */
-       int     (*if_reset)();          /* bus reset routine */
-       int     (*if_watchdog)();       /* timer routine */
+       void    (*if_init)(int); /* init routine */
+       int (*if_output)(struct ifnet *, struct mbuf *, struct sockaddr *, 
+                        struct rtentry *); /* output routine (enqueue) */
+       void (*if_start)(struct ifnet *); /* initiate output routine */
+       int (*if_done)(struct ifnet *); /* output complete routine */
+       int (*if_ioctl)(struct ifnet *, int, caddr_t); /* ioctl routine */
+       void (*if_reset)(int, int); /* bus reset routine */
+       void (*if_watchdog)(int); /* 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 */
@@ -116,8 +123,6 @@ struct ifnet {
        int     if_noproto;             /* destined for unsupported protocol */
        int     if_baudrate;            /* linespeed */
         int    if_pcount;              /* number of promiscuous listeners */
        int     if_noproto;             /* destined for unsupported protocol */
        int     if_baudrate;            /* linespeed */
         int    if_pcount;              /* number of promiscuous listeners */
-/* new longer if_flags here for alignment; recompile netstat anyway */
-       u_int   if_flags;               /* flags defined below */
 };
 
 #define        IFF_UP          0x1             /* interface is up */
 };
 
 #define        IFF_UP          0x1             /* interface is up */
@@ -128,25 +133,22 @@ struct ifnet {
 #define        IFF_NOTRAILERS  0x20            /* avoid use of trailers */
 #define        IFF_RUNNING     0x40            /* resources allocated */
 #define        IFF_NOARP       0x80            /* no address resolution protocol */
 #define        IFF_NOTRAILERS  0x20            /* avoid use of trailers */
 #define        IFF_RUNNING     0x40            /* resources allocated */
 #define        IFF_NOARP       0x80            /* no address resolution protocol */
+/* next two not supported now, but reserved: */
 #define        IFF_PROMISC     0x100           /* receive all packets */
 #define        IFF_ALLMULTI    0x200           /* receive all multicast packets */
 #define        IFF_OACTIVE     0x400           /* transmission in progress */
 #define        IFF_SIMPLEX     0x800           /* can't hear own transmissions */
 #define        IFF_PROMISC     0x100           /* receive all packets */
 #define        IFF_ALLMULTI    0x200           /* receive all multicast packets */
 #define        IFF_OACTIVE     0x400           /* transmission in progress */
 #define        IFF_SIMPLEX     0x800           /* can't hear own transmissions */
-#define        IFF_LLC0        0x1000          /* IEEE 802.2 LLC class 0 in use */
-#define        IFF_LLC1        0x2000          /* IEEE 802.2 LLC class 1 in use */
-#define        IFF_LLC2        0x4000          /* IEEE 802.2 LLC class 2 in use */
-                                       /* note IEEE 802.2 == ISO 8802-2 */
-#define IFF_MULTICAST  0x8000          /* driver supports IP multicast */
-#define IFF_VIRTUAL    0x10000         /* this interface is a VIF */
-#define IFF_ALTPHYS    0x20000         /* use alternative physical if in */
-                                       /* driver (e.g., AUI vs BNC vs UTP) */
-#define IFF_ALTPHYS2   0x40000         /* same as above, in case you have */
-                                       /* more than just two phys types */
+#define        IFF_LLC0        0x1000          /* IEEE 802.2 LLC class 0 */
+#define        IFF_LLC1        0x2000          /* IEEE 802.2 LLC class 1 */
+#define        IFF_LLC2        0x4000          /* IEEE 802.2 LLC class 2 */
+#define IFF_ALTPHYS    0x8000  /* alternative physical connection */
+#define IFF_MULTICAST  0x10000 /* i'face supports multicast */
+#define IFF_VIRTUAL    0x20000 /* i'face is really a VIF */
 
 /* flags set internally only: */
 #define        IFF_CANTCHANGE \
 
 /* flags set internally only: */
 #define        IFF_CANTCHANGE \
-       (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|IFF_SIMPLEX \
-       |IFF_MULTICAST|IFF_VIRTUAL)
+       (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|IFF_SIMPLEX\
+        |IFF_MULTICAST|IFF_VIRTUAL)
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
@@ -191,6 +193,8 @@ struct ifnet {
  * are allocated and attached when an address is set, and are linked
  * together so all addresses for an interface can be located.
  */
  * are allocated and attached when an address is set, and are linked
  * together so all addresses for an interface can be located.
  */
+struct rtentry;
+
 struct ifaddr {
        struct  sockaddr *ifa_addr;     /* address of interface */
        struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */
 struct ifaddr {
        struct  sockaddr *ifa_addr;     /* address of interface */
        struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */
@@ -198,7 +202,8 @@ struct ifaddr {
        struct  sockaddr *ifa_netmask;  /* used to determine subnet */
        struct  ifnet *ifa_ifp;         /* back-pointer to interface */
        struct  ifaddr *ifa_next;       /* next address for interface */
        struct  sockaddr *ifa_netmask;  /* used to determine subnet */
        struct  ifnet *ifa_ifp;         /* back-pointer to interface */
        struct  ifaddr *ifa_next;       /* next address for interface */
-       int     (*ifa_rtrequest)();     /* check or clean routes (+ or -)'d */
+       void    (*ifa_rtrequest)(int, struct rtentry *, struct sockaddr *);
+                                       /* check or clean routes (+ or -)'d */
        struct  rtentry *ifa_rt;        /* ??? for ROUTETOIF */
        u_short ifa_flags;              /* mostly rt_flags for cloning */
        u_short ifa_llinfolen;          /* extra to malloc for link info */
        struct  rtentry *ifa_rt;        /* ??? for ROUTETOIF */
        u_short ifa_flags;              /* mostly rt_flags for cloning */
        u_short ifa_llinfolen;          /* extra to malloc for link info */
@@ -254,10 +259,18 @@ struct    ifconf {
 
 #ifdef KERNEL
 #include "../net/if_arp.h"
 
 #ifdef KERNEL
 #include "../net/if_arp.h"
-struct ifqueue rawintrq;               /* raw packet input queue */
-struct ifnet *ifnet;
+extern struct  ifqueue rawintrq;               /* raw packet input queue */
+extern struct  ifnet *ifnet;
 struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();
 struct ifaddr *ifa_ifwithdstaddr();
 struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();
 struct ifaddr *ifa_ifwithdstaddr();
-#else KERNEL
+extern int ifpromisc(struct ifnet *, int);
+
+/* Loopback interface, used internally by non-loopback code */
+extern struct  ifnet loif;
+extern int looutput(struct ifnet *, struct mbuf *, struct sockaddr *,
+                   struct rtentry *);
+
+#else /* KERNEL */
 #include <net/if_arp.h>
 #include <net/if_arp.h>
-#endif KERNEL
+#endif /* KERNEL */
+#endif /* _NET_IF_H_ */