merge in vnodes
[unix-history] / usr / src / sys / net / if.h
index 30798dc..1bcdb8e 100644 (file)
@@ -3,13 +3,18 @@
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of California at 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'' without express or implied warranty.
+ * 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.2 (Berkeley) %G%
+ *     @(#)if.h        7.5 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -59,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 */
@@ -71,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 */
@@ -84,8 +94,11 @@ struct ifnet {
 /* next two not supported now, but reserved: */
 #define        IFF_PROMISC     0x100           /* receive all packets */
 #define        IFF_ALLMULTI    0x200           /* receive all multicast packets */
 /* 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)
@@ -111,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) { \
@@ -157,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
@@ -193,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