]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netinet6/in6.h
xnu-1504.3.12.tar.gz
[apple/xnu.git] / bsd / netinet6 / in6.h
index a84715b19260ad635b1d866b286b67be2b47a5c9..fb0479fde5711b47cb6e64587e6f06854a7d1f67 100644 (file)
@@ -1,3 +1,31 @@
+/*
+ * Copyright (c) 2008 Apple Inc. All rights reserved.
+ *
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
+ * 
+ * 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. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
+ * 
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
+ */
+
 /*     $FreeBSD: src/sys/netinet6/in6.h,v 1.7.2.4 2001/07/04 09:45:23 ume Exp $        */
 /*     $KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $    */
 
@@ -159,10 +187,10 @@ struct sockaddr_in6 {
        __uint32_t      sin6_scope_id;  /* scope zone index */
 };
 
+#ifdef KERNEL  /*XXX nonstandard*/
 /*
  * Local definition for masks
  */
-#ifdef KERNEL  /*XXX nonstandard*/
 #define IN6MASK0       {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
 #define IN6MASK32      {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
@@ -184,11 +212,10 @@ extern const struct in6_addr in6mask96;
 extern const struct in6_addr in6mask128;
 #endif /* KERNEL_PRIVATE */
 
-
+#ifdef KERNEL  /*XXX nonstandard*/
 /*
  * Macros started with IPV6_ADDR is KAME local
  */
-#ifdef KERNEL  /*XXX nonstandard*/
 #if BYTE_ORDER == BIG_ENDIAN
 #define IPV6_ADDR_INT32_ONE    1
 #define IPV6_ADDR_INT32_TWO    2
@@ -305,6 +332,7 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
 
 #ifdef KERNEL  /*XXX nonstandard*/
 #define IPV6_ADDR_SCOPE_NODELOCAL      0x01
+#define        IPV6_ADDR_SCOPE_INTFACELOCAL    0x01
 #define IPV6_ADDR_SCOPE_LINKLOCAL      0x02
 #define IPV6_ADDR_SCOPE_SITELOCAL      0x05
 #define IPV6_ADDR_SCOPE_ORGLOCAL       0x08    /* just used in this file */
@@ -344,6 +372,9 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
 #define IN6_IS_ADDR_MC_NODELOCAL(a)    \
        (IN6_IS_ADDR_MULTICAST(a) &&    \
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
+#define        IN6_IS_ADDR_MC_INTFACELOCAL(a)  \
+       (IN6_IS_ADDR_MULTICAST(a) &&    \
+       (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))
 #define IN6_IS_ADDR_MC_LINKLOCAL(a)    \
        (IN6_IS_ADDR_MULTICAST(a) &&    \
         (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
@@ -382,6 +413,11 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
        ((IN6_IS_ADDR_LINKLOCAL(a)) ||  \
         (IN6_IS_ADDR_MC_LINKLOCAL(a)))
 
+#define IN6_IS_SCOPE_EMBED(a)                  \
+       ((IN6_IS_ADDR_LINKLOCAL(a)) ||          \
+       (IN6_IS_ADDR_MC_LINKLOCAL(a)) ||        \
+       (IN6_IS_ADDR_MC_INTFACELOCAL(a)))
+
 #define IFA6_IS_DEPRECATED(a) \
        ((a)->ia6_lifetime.ia6t_preferred != 0 && \
         (a)->ia6_lifetime.ia6t_preferred < timenow.tv_sec)
@@ -396,8 +432,14 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
 #ifdef PRIVATE
 struct route_in6 {
-       struct  rtentry *ro_rt;
-       struct  sockaddr_in6 ro_dst;
+       /*
+        * N.B: struct route_in6 must begin with ro_rt and ro_flags
+        * because the code does some casts of a 'struct route_in6 *'
+        * to a 'struct route *'.
+        */
+       struct rtentry  *ro_rt;
+       __uint32_t      ro_flags;       /* route flags */
+       struct sockaddr_in6 ro_dst;
 };
 #endif /* PRIVATE */
 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
@@ -458,6 +500,9 @@ struct route_in6 {
 #define IPV6_FW_GET            34 /* get entire firewall rule chain */
 #endif /* 1 */
 
+#define IPV6_RECVTCLASS         35 /* bool; recv traffic class values */
+#define IPV6_TCLASS             36 /* int; send traffic class value */
+
 /* to define items, should talk with KAME guys first, for *BSD compatibility */
 
 #define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */
@@ -623,14 +668,14 @@ extern int in6_localaddr(struct in6_addr *);
 extern int in6_addrscope(struct in6_addr *);
 extern struct in6_ifaddr *in6_ifawithscope(struct ifnet *, struct in6_addr *);
 extern struct in6_ifaddr *in6_ifawithifp(struct ifnet *, struct in6_addr *);
-extern void in6_if_up(struct ifnet *, struct in6_aliasreq *);
+extern int in6_if_up(struct ifnet *, struct in6_aliasreq *);
 struct sockaddr;
 
 extern void in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6);
 extern void in6_sin_2_v4mapsin6(struct sockaddr_in *sin,
     struct sockaddr_in6 *sin6);
 extern void in6_sin6_2_sin_in_sock(struct sockaddr *nam);
-extern void in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
+extern int in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam);
 
 #define        satosin6(sa)    ((struct sockaddr_in6 *)(sa))
 #define        sin6tosa(sin6)  ((struct sockaddr *)(sin6))