merge in vnodes
[unix-history] / usr / src / sys / net / if.h
index 6a6c9a2..1bcdb8e 100644 (file)
@@ -1,9 +1,20 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved.
  *
  *
- *     @(#)if.h        6.12 (Berkeley) %G%
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ *     @(#)if.h        7.5 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -53,7 +64,9 @@ struct ifnet {
        } if_snd;                       /* output queue */
 /* procedure handles */
        int     (*if_init)();           /* init routine */
        } if_snd;                       /* output queue */
 /* procedure handles */
        int     (*if_init)();           /* init routine */
-       int     (*if_output)();         /* output 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 */
        int     (*if_ioctl)();          /* ioctl routine */
        int     (*if_reset)();          /* bus reset routine */
        int     (*if_watchdog)();       /* timer routine */
@@ -65,6 +78,9 @@ struct ifnet {
        int     if_collisions;          /* collisions on csma interfaces */
 /* end statistics */
        struct  ifnet *if_next;
        int     if_collisions;          /* collisions on csma interfaces */
 /* end statistics */
        struct  ifnet *if_next;
+       u_char  if_type;                /* ethernet, tokenring, etc */
+       u_char  if_addrlen;             /* media address length */
+       u_char  if_hdrlen;              /* media header length */
 };
 
 #define        IFF_UP          0x1             /* interface is up */
 };
 
 #define        IFF_UP          0x1             /* interface is up */
@@ -75,8 +91,14 @@ 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 */
+
 /* flags set internally only: */
 /* flags set internally only: */
-#define        IFF_CANTCHANGE  (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING)
+#define        IFF_CANTCHANGE  (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE)
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
 
 /*
  * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
@@ -102,32 +124,6 @@ struct ifnet {
        (ifq)->ifq_head = (m); \
        (ifq)->ifq_len++; \
 }
        (ifq)->ifq_head = (m); \
        (ifq)->ifq_len++; \
 }
-/*
- * Packets destined for level-1 protocol input routines
- * have a pointer to the receiving interface prepended to the data.
- * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet.
- * IF_ADJ should be used otherwise to adjust for its presence.
- */
-#define        IF_ADJ(m) { \
-       (m)->m_off += sizeof(struct ifnet *); \
-       (m)->m_len -= sizeof(struct ifnet *); \
-       if ((m)->m_len == 0) { \
-               struct mbuf *n; \
-               MFREE((m), n); \
-               (m) = n; \
-       } \
-}
-#define        IF_DEQUEUEIF(ifq, m, ifp) { \
-       (m) = (ifq)->ifq_head; \
-       if (m) { \
-               if (((ifq)->ifq_head = (m)->m_act) == 0) \
-                       (ifq)->ifq_tail = 0; \
-               (m)->m_act = 0; \
-               (ifq)->ifq_len--; \
-               (ifp) = *(mtod((m), struct ifnet **)); \
-               IF_ADJ(m); \
-       } \
-}
 #define        IF_DEQUEUE(ifq, m) { \
        (m) = (ifq)->ifq_head; \
        if (m) { \
 #define        IF_DEQUEUE(ifq, m) { \
        (m) = (ifq)->ifq_head; \
        if (m) { \
@@ -148,17 +144,13 @@ struct ifnet {
  * together so all addresses for an interface can be located.
  */
 struct ifaddr {
  * together so all addresses for an interface can be located.
  */
 struct ifaddr {
-       struct  sockaddr ifa_addr;      /* address of interface */
-       union {
-               struct  sockaddr ifu_broadaddr;
-               struct  sockaddr ifu_dstaddr;
-       } ifa_ifu;
-#define        ifa_broadaddr   ifa_ifu.ifu_broadaddr   /* broadcast address */
-#define        ifa_dstaddr     ifa_ifu.ifu_dstaddr     /* other end of p-to-p link */
+       struct  sockaddr *ifa_addr;     /* address of interface */
+       struct  sockaddr *ifa_dstaddr;  /* other end of p-to-p link */
+#define        ifa_broadaddr   ifa_dstaddr     /* broadcast address 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 */
 };
        struct  ifnet *ifa_ifp;         /* back-pointer to interface */
        struct  ifaddr *ifa_next;       /* next address for interface */
 };
-
 /*
  * Interface request structure used for socket
  * ioctl's.  All interface ioctl's must have parameter
 /*
  * Interface request structure used for socket
  * ioctl's.  All interface ioctl's must have parameter
@@ -184,6 +176,13 @@ struct     ifreq {
 #define        ifr_data        ifr_ifru.ifru_data      /* for use by interface */
 };
 
 #define        ifr_data        ifr_ifru.ifru_data      /* for use by interface */
 };
 
+struct ifaliasreq {
+       char    ifra_name[IFNAMSIZ];            /* if name, e.g. "en0" */
+       struct  sockaddr ifra_addr;
+       struct  sockaddr ifra_broadaddr;
+       struct  sockaddr ifra_mask;
+};
+
 /*
  * Structure used in SIOCGIFCONF request.
  * Used to retrieve interface configuration
 /*
  * Structure used in SIOCGIFCONF request.
  * Used to retrieve interface configuration
@@ -202,12 +201,9 @@ struct     ifconf {
 
 #ifdef KERNEL
 #include "../net/if_arp.h"
 
 #ifdef KERNEL
 #include "../net/if_arp.h"
-#ifdef INET
-struct ifqueue ipintrq;                /* ip packet input queue */
-#endif
 struct ifqueue rawintrq;               /* raw packet input queue */
 struct ifnet *ifnet;
 struct ifqueue rawintrq;               /* raw packet input queue */
 struct ifnet *ifnet;
-struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet(), *ifa_ifwithaf();
+struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();
 struct ifaddr *ifa_ifwithdstaddr();
 #else KERNEL
 #include <net/if_arp.h>
 struct ifaddr *ifa_ifwithdstaddr();
 #else KERNEL
 #include <net/if_arp.h>