1*699cd480SApple OSS Distributions /* 2*699cd480SApple OSS Distributions * Copyright (c) 2011-2013 Apple Inc. All rights reserved. 3*699cd480SApple OSS Distributions * 4*699cd480SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5*699cd480SApple OSS Distributions * 6*699cd480SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code 7*699cd480SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License 8*699cd480SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in 9*699cd480SApple OSS Distributions * compliance with the License. The rights granted to you under the License 10*699cd480SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of, 11*699cd480SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to 12*699cd480SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any 13*699cd480SApple OSS Distributions * terms of an Apple operating system software license agreement. 14*699cd480SApple OSS Distributions * 15*699cd480SApple OSS Distributions * Please obtain a copy of the License at 16*699cd480SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file. 17*699cd480SApple OSS Distributions * 18*699cd480SApple OSS Distributions * The Original Code and all software distributed under the License are 19*699cd480SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20*699cd480SApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21*699cd480SApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22*699cd480SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23*699cd480SApple OSS Distributions * Please see the License for the specific language governing rights and 24*699cd480SApple OSS Distributions * limitations under the License. 25*699cd480SApple OSS Distributions * 26*699cd480SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27*699cd480SApple OSS Distributions */ 28*699cd480SApple OSS Distributions 29*699cd480SApple OSS Distributions #ifndef __NET_NETSRC_H__ 30*699cd480SApple OSS Distributions 31*699cd480SApple OSS Distributions #include <netinet/in.h> 32*699cd480SApple OSS Distributions 33*699cd480SApple OSS Distributions #define NETSRC_CTLNAME "com.apple.netsrc" 34*699cd480SApple OSS Distributions 35*699cd480SApple OSS Distributions #define NETSRC_VERSION1 1 36*699cd480SApple OSS Distributions #define NETSRC_VERSION2 2 37*699cd480SApple OSS Distributions #define NETSRC_CURVERS NETSRC_VERSION2 38*699cd480SApple OSS Distributions 39*699cd480SApple OSS Distributions struct netsrc_req { 40*699cd480SApple OSS Distributions unsigned int nrq_ver; 41*699cd480SApple OSS Distributions unsigned int nrq_ifscope; 42*699cd480SApple OSS Distributions union { 43*699cd480SApple OSS Distributions union sockaddr_in_4_6 nrq_dst; 44*699cd480SApple OSS Distributions union sockaddr_in_4_6 _usa; 45*699cd480SApple OSS Distributions }; 46*699cd480SApple OSS Distributions }; 47*699cd480SApple OSS Distributions 48*699cd480SApple OSS Distributions #define nrq_sin _usa.sin 49*699cd480SApple OSS Distributions #define nrq_sin6 _usa.sin6 50*699cd480SApple OSS Distributions 51*699cd480SApple OSS Distributions struct netsrc_repv1 { 52*699cd480SApple OSS Distributions union { 53*699cd480SApple OSS Distributions union sockaddr_in_4_6 nrp_src; 54*699cd480SApple OSS Distributions union sockaddr_in_4_6 _usa; 55*699cd480SApple OSS Distributions }; 56*699cd480SApple OSS Distributions #define NETSRC_IP6_FLAG_TENTATIVE 0x0001 57*699cd480SApple OSS Distributions #define NETSRC_IP6_FLAG_TEMPORARY 0x0002 58*699cd480SApple OSS Distributions #define NETSRC_IP6_FLAG_DEPRECATED 0x0004 59*699cd480SApple OSS Distributions #define NETSRC_IP6_FLAG_OPTIMISTIC 0x0008 60*699cd480SApple OSS Distributions #define NETSRC_IP6_FLAG_SECURED 0x0010 61*699cd480SApple OSS Distributions uint16_t nrp_flags; 62*699cd480SApple OSS Distributions uint16_t nrp_label; 63*699cd480SApple OSS Distributions uint16_t nrp_precedence; 64*699cd480SApple OSS Distributions uint16_t nrp_dstlabel; 65*699cd480SApple OSS Distributions uint16_t nrp_dstprecedence; 66*699cd480SApple OSS Distributions uint16_t nrp_unused; // Padding 67*699cd480SApple OSS Distributions }; 68*699cd480SApple OSS Distributions 69*699cd480SApple OSS Distributions struct netsrc_repv2 { 70*699cd480SApple OSS Distributions union { 71*699cd480SApple OSS Distributions union sockaddr_in_4_6 nrp_src; 72*699cd480SApple OSS Distributions union sockaddr_in_4_6 _usa; 73*699cd480SApple OSS Distributions }; 74*699cd480SApple OSS Distributions uint32_t nrp_min_rtt; 75*699cd480SApple OSS Distributions uint32_t nrp_connection_attempts; 76*699cd480SApple OSS Distributions uint32_t nrp_connection_successes; 77*699cd480SApple OSS Distributions // Continues from above, fixes naming 78*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_TENTATIVE NETSRC_IP6_FLAG_TENTATIVE 79*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_TEMPORARY NETSRC_IP6_FLAG_TEMPORARY 80*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_DEPRECATED NETSRC_IP6_FLAG_DEPRECATED 81*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_OPTIMISTIC NETSRC_IP6_FLAG_OPTIMISTIC 82*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_SECURED NETSRC_IP6_FLAG_SECURED 83*699cd480SApple OSS Distributions #define NETSRC_FLAG_ROUTEABLE 0x00000020 84*699cd480SApple OSS Distributions #define NETSRC_FLAG_DIRECT 0x00000040 85*699cd480SApple OSS Distributions #define NETSRC_FLAG_AWDL 0x00000080 86*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_DYNAMIC 0x00000100 87*699cd480SApple OSS Distributions #define NETSRC_FLAG_IP6_AUTOCONF 0x00000200 88*699cd480SApple OSS Distributions uint32_t nrp_flags; 89*699cd480SApple OSS Distributions uint16_t nrp_label; 90*699cd480SApple OSS Distributions uint16_t nrp_precedence; 91*699cd480SApple OSS Distributions uint16_t nrp_dstlabel; 92*699cd480SApple OSS Distributions uint16_t nrp_dstprecedence; 93*699cd480SApple OSS Distributions uint16_t nrp_ifindex; 94*699cd480SApple OSS Distributions uint16_t nrp_unused; // Padding 95*699cd480SApple OSS Distributions }; 96*699cd480SApple OSS Distributions 97*699cd480SApple OSS Distributions #define netsrc_rep netsrc_repv2 98*699cd480SApple OSS Distributions 99*699cd480SApple OSS Distributions #define nrp_sin nrp_src.sin 100*699cd480SApple OSS Distributions #define nrp_sin6 nrp_src.sin6 101*699cd480SApple OSS Distributions 102*699cd480SApple OSS Distributions #ifdef KERNEL_PRIVATE 103*699cd480SApple OSS Distributions __private_extern__ void netsrc_init(void); 104*699cd480SApple OSS Distributions #endif 105*699cd480SApple OSS Distributions 106*699cd480SApple OSS Distributions #endif /* __NET_NETSRC_H__ */ 107