]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet/in_var.h
xnu-344.49.tar.gz
[apple/xnu.git] / bsd / netinet / in_var.h
index ad84f6e40590b7fc242a10a7ff9b892b93ad2ad8..16baa2c1564e426b6133db1cd4a4903dad616fbc 100644 (file)
@@ -3,19 +3,22 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
  * SUCH DAMAGE.
  *
  *     @(#)in_var.h    8.2 (Berkeley) 1/9/95
+ * $FreeBSD: src/sys/netinet/in_var.h,v 1.33.2.2 2001/07/17 10:50:01 ru Exp $
  */
 
 #ifndef _NETINET_IN_VAR_H_
 #define _NETINET_IN_VAR_H_
+#include <sys/appleapiopts.h>
 
 #include <sys/queue.h>
+#ifdef __APPLE__
 #include <sys/kern_event.h>
+#endif
+
+#ifdef __APPLE_API_UNSTABLE
 
 /*
  * Interface address, Internet version.  One of these structures
@@ -89,14 +98,15 @@ struct      in_aliasreq {
        struct  sockaddr_in ifra_broadaddr;
 #define ifra_dstaddr ifra_broadaddr
        struct  sockaddr_in ifra_mask;
+#ifdef __APPLE__
         u_long              dlt;
+#endif
 };
 
-
+#ifdef __APPLE__
 /*
  * Event data, internet style.
  */
-
 struct kev_in_data {
         struct net_event_data   link_data;
        struct in_addr  ia_addr;
@@ -108,6 +118,12 @@ struct kev_in_data {
        struct  in_addr ia_dstaddr;
 };
 
+struct kev_in_collision {
+       struct  net_event_data  link_data;      /* link colliding arp was received on */
+       struct  in_addr ia_ipaddr;      /* IP address we and another node are using */
+       u_char  hw_len; /* length of hardware address */
+       u_char  hw_addr[0];     /* variable length hardware address */
+};
 
 
 /*
@@ -122,6 +138,8 @@ struct kev_in_data {
 #define KEV_INET_SIFDSTADDR   4
 #define KEV_INET_SIFBRDADDR   5
 #define KEV_INET_SIFNETMASK   6
+#define KEV_INET_ARPCOLLISION 7        /* use kev_in_collision */
+#endif /* __APPLE__ */
 
 /*
  * Given a pointer to an in_ifaddr (ifaddr),
@@ -133,8 +151,10 @@ struct kev_in_data {
 #define IN_LNAOF(in, ifa) \
        ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))
 
+#endif /* __APPLE_API_UNSTABLE */
 
 #ifdef KERNEL
+#ifdef __APPLE_API_PRIVATE
 extern TAILQ_HEAD(in_ifaddrhead, in_ifaddr) in_ifaddrhead;
 extern struct  ifqueue ipintrq;                /* ip packet input queue */
 extern struct  in_addr zeroin_addr;
@@ -148,20 +168,11 @@ extern    u_char  inetctlerrmap[];
        /* struct in_addr addr; */ \
        /* struct ifnet *ifp; */ \
 { \
-       register struct in_ifaddr *ia; \
+       struct in_ifaddr *ia; \
 \
-       for (ia = in_ifaddrhead.tqh_first; \
-           ia != NULL && ((ia->ia_ifp->if_flags & IFF_POINTOPOINT)? \
-               IA_DSTSIN(ia):IA_SIN(ia))->sin_addr.s_addr != (addr).s_addr; \
-           ia = ia->ia_link.tqe_next) \
-                continue; \
-       if (ia == NULL) \
-           for (ia = in_ifaddrhead.tqh_first; \
-               ia != NULL; \
-               ia = ia->ia_link.tqe_next) \
-                   if (ia->ia_ifp->if_flags & IFF_POINTOPOINT && \
-                       IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \
-                           break; \
+       TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) \
+               if (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \
+                       break; \
        (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
 }
 
@@ -173,13 +184,15 @@ extern    u_char  inetctlerrmap[];
        /* struct ifnet *ifp; */ \
        /* struct in_ifaddr *ia; */ \
 { \
-       for ((ia) = in_ifaddrhead.tqh_first; \
+       for ((ia) = TAILQ_FIRST(&in_ifaddrhead); \
            (ia) != NULL && (ia)->ia_ifp != (ifp); \
-           (ia) = (ia)->ia_link.tqe_next) \
+           (ia) = TAILQ_NEXT((ia), ia_link)) \
                continue; \
 }
+#endif /* __APPLE_API_PRIVATE */
 #endif
 
+#ifdef __APPLE_API_UNSTABLE
 /*
  * This information should be part of the ifnet structure but we don't wish
  * to change that - as it might break a number of things
@@ -209,8 +222,10 @@ struct in_multi {
        u_int   inm_state;              /*  state of the membership */
        struct  router_info *inm_rti;   /* router info*/
 };
+#endif /* __APPLE_API_UNSTABLE */
 
 #ifdef KERNEL
+#ifdef __APPLE_API_PRIVATE
 
 #ifdef SYSCTL_DECL
 SYSCTL_DECL(_net_inet_ip);
@@ -236,10 +251,9 @@ struct in_multistep {
        /* struct ifnet *ifp; */ \
        /* struct in_multi *inm; */ \
 do { \
-       register struct ifmultiaddr *ifma; \
+       struct ifmultiaddr *ifma; \
 \
-       for (ifma = (ifp)->if_multiaddrs.lh_first; ifma; \
-            ifma = ifma->ifma_link.le_next) { \
+       LIST_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { \
                if (ifma->ifma_addr->sa_family == AF_INET \
                    && ((struct sockaddr_in *)ifma->ifma_addr)->sin_addr.s_addr == \
                    (addr).s_addr) \
@@ -260,14 +274,14 @@ do { \
        /* struct in_multi *inm; */ \
 do { \
        if (((inm) = (step).i_inm) != NULL) \
-               (step).i_inm = (step).i_inm->inm_link.le_next; \
+               (step).i_inm = LIST_NEXT((step).i_inm, inm_link); \
 } while(0)
 
 #define IN_FIRST_MULTI(step, inm) \
        /* struct in_multistep step; */ \
        /* struct in_multi *inm; */ \
 do { \
-       (step).i_inm = in_multihead.lh_first; \
+       (step).i_inm = LIST_FIRST(&in_multihead); \
        IN_NEXT_MULTI((step), (inm)); \
 } while(0)
 
@@ -278,16 +292,16 @@ int       in_control __P((struct socket *, u_long, caddr_t, struct ifnet *,
                        struct proc *));
 void   in_rtqdrain __P((void));
 void   ip_input __P((struct mbuf *));
-int    in_ifadown __P((struct ifaddr *ifa));
+int    in_ifadown __P((struct ifaddr *ifa, int));
 void   in_ifscrub __P((struct ifnet *, struct in_ifaddr *));
 int    ipflow_fastforward __P((struct mbuf *));
 void   ipflow_create __P((const struct route *, struct mbuf *));
 void   ipflow_slowtimo __P((void));
 
-#endif /* KERNEL */
-#if INET6
+#endif /* __APPLE_API_PRIVATE */
+#endif /* _KERNEL */
+
 /* INET6 stuff */
 #include <netinet6/in6_var.h>
-#endif
 
 #endif /* _NETINET_IN_VAR_H_ */