this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net builds

+4952 -10
+9
duct/include/dispatch/private.h
··· 1 + #ifndef _DISPATCH_PRIVATE_H 2 + #define _DISPATCH_PRIVATE_H 3 + 4 + static inline void dispatch_atfork_prepare(void) {} 5 + static inline void dispatch_atfork_parent(void) {} 6 + static inline void dispatch_atfork_child(void) {} 7 + 8 + #endif 9 +
+3 -1
libc/CMakeLists.txt
··· 60 60 add_subdirectory(pthreads) 61 61 add_subdirectory(posix1e) 62 62 add_subdirectory(nls) 63 + add_subdirectory(net) 63 64 64 65 add_library(system_c SHARED 65 66 $<TARGET_OBJECTS:libc-db> ··· 82 83 $<TARGET_OBJECTS:libc-pthreads> 83 84 $<TARGET_OBJECTS:libc-pthreads_cancelable> 84 85 $<TARGET_OBJECTS:libc-posix1e> 85 - $<TARGET_OBJECTS:libc-nls>) 86 + $<TARGET_OBJECTS:libc-nls> 87 + $<TARGET_OBJECTS:libc-net>) 86 88 87 89 # TODO: see ./xcodescripts/variants.xcconfig 88 90
+27
libc/net/CMakeLists.txt
··· 1 + project(libc-net) 2 + 3 + cmake_minimum_required(VERSION 2.4.0) 4 + 5 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/../../platform-include/net/if_var.h") 6 + 7 + set(net_sources 8 + FreeBSD/addr2ascii.c 9 + FreeBSD/ascii2addr.c 10 + FreeBSD/inet_addr.c 11 + FreeBSD/inet_lnaof.c 12 + FreeBSD/inet_makeaddr.c 13 + FreeBSD/inet_neta.c 14 + FreeBSD/inet_net_ntop.c 15 + FreeBSD/inet_netof.c 16 + FreeBSD/inet_net_pton.c 17 + FreeBSD/inet_network.c 18 + FreeBSD/inet_ntoa.c 19 + FreeBSD/linkaddr.c 20 + FreeBSD/nsap_addr.c 21 + FreeBSD/recv.c 22 + FreeBSD/send.c 23 + FreeBSD/sockatmark.c 24 + FreeBSD/sourcefilter.c 25 + ) 26 + 27 + add_library(libc-net OBJECT ${net_sources})
+30 -9
platform-include/arpa/inet.h
··· 1 + /* 2 + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_LICENSE_HEADER_START@ 5 + * 6 + * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights 7 + * Reserved. This file contains Original Code and/or Modifications of 8 + * Original Code as defined in and that are subject to the Apple Public 9 + * Source License Version 1.1 (the "License"). You may not use this file 10 + * except in compliance with the License. Please obtain a copy of the 11 + * License at http://www.apple.com/publicsource and read it before using 12 + * this file. 13 + * 14 + * The Original Code and all software distributed under the License are 15 + * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 16 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 17 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 18 + * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the 19 + * License for the specific language governing rights and limitations 20 + * under the License. 21 + * 22 + * @APPLE_LICENSE_HEADER_END@ 23 + */ 1 24 /* 2 25 * ++Copyright++ 1983, 1993 3 26 * - ··· 58 81 * $Id: inet.h,v 1.10 2006/02/01 18:09:47 majka Exp $ 59 82 */ 60 83 61 - #ifndef _ARPA_INET_H_ 62 - #define _ARPA_INET_H_ 84 + #ifndef _INET_H_ 85 + #define _INET_H_ 63 86 64 - /* External definitions for functions in inet(3), addr2ascii(3) */ 87 + /* External definitions for functions in inet(3) */ 65 88 66 - #include <sys/cdefs.h> 67 - #include <sys/_types.h> 89 + #include <_types.h> 68 90 #include <stdint.h> /* uint32_t uint16_t */ 69 91 #include <machine/endian.h> /* htonl() and family if (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ 70 92 #include <sys/_endian.h> /* htonl() and family if (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ ··· 76 98 char *inet_ntoa(struct in_addr); 77 99 const char *inet_ntop(int, const void *, char *, socklen_t); 78 100 int inet_pton(int, const char *, void *); 79 - 80 101 #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 81 102 int ascii2addr(int, const char *, void *); 82 103 char *addr2ascii(int, const void *, int, char *); ··· 88 109 char *inet_net_ntop(int, const void *, int, char *, __darwin_size_t); 89 110 int inet_net_pton(int, const char *, void *, __darwin_size_t); 90 111 char *inet_neta(in_addr_t, char *, __darwin_size_t); 91 - unsigned int inet_nsap_addr(const char *, unsigned char *, int); 92 - char *inet_nsap_ntoa(int, const unsigned char *, char *); 112 + unsigned int inet_nsap_addr(const char *, unsigned char *, int maxlen); 113 + char *inet_nsap_ntoa(int, const unsigned char *, char *ascii); 93 114 #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 94 115 95 116 __END_DECLS 96 117 97 - #endif /* !_ARPA_INET_H_ */ 118 + #endif /* !_INET_H_ */
+67
platform-include/ifaddrs.h
··· 1 + /* $FreeBSD: src/include/ifaddrs.h,v 1.3.32.1.4.1 2010/06/14 02:09:06 kensmith Exp $ */ 2 + 3 + /* 4 + * Copyright (c) 1995, 1999 5 + * Berkeley Software Design, Inc. All rights reserved. 6 + * 7 + * Redistribution and use in source and binary forms, with or without 8 + * modification, are permitted provided that the following conditions 9 + * are met: 10 + * 1. Redistributions of source code must retain the above copyright 11 + * notice, this list of conditions and the following disclaimer. 12 + * 13 + * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND 14 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16 + * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE 17 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 + * SUCH DAMAGE. 24 + * 25 + * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp 26 + */ 27 + 28 + #ifndef _IFADDRS_H_ 29 + #define _IFADDRS_H_ 30 + 31 + #include <Availability.h> 32 + 33 + struct ifaddrs { 34 + struct ifaddrs *ifa_next; 35 + char *ifa_name; 36 + unsigned int ifa_flags; 37 + struct sockaddr *ifa_addr; 38 + struct sockaddr *ifa_netmask; 39 + struct sockaddr *ifa_dstaddr; 40 + void *ifa_data; 41 + }; 42 + 43 + /* 44 + * This may have been defined in <net/if.h>. Note that if <net/if.h> is 45 + * to be included it must be included before this header file. 46 + */ 47 + #ifndef ifa_broadaddr 48 + #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 49 + #endif 50 + 51 + struct ifmaddrs { 52 + struct ifmaddrs *ifma_next; 53 + struct sockaddr *ifma_name; 54 + struct sockaddr *ifma_addr; 55 + struct sockaddr *ifma_lladdr; 56 + }; 57 + 58 + #include <sys/cdefs.h> 59 + 60 + __BEGIN_DECLS 61 + extern int getifaddrs(struct ifaddrs **); 62 + extern void freeifaddrs(struct ifaddrs *); 63 + extern int getifmaddrs(struct ifmaddrs **) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); 64 + extern void freeifmaddrs(struct ifmaddrs *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3); 65 + __END_DECLS 66 + 67 + #endif
+587
platform-include/nameser.h
··· 1 + /* 2 + * Copyright (c) 1983, 1989, 1993 3 + * The Regents of the University of California. All rights reserved. 4 + * 5 + * Redistribution and use in source and binary forms, with or without 6 + * modification, are permitted provided that the following conditions 7 + * are met: 8 + * 1. Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * 2. Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * 3. All advertising materials mentioning features or use of this software 14 + * must display the following acknowledgement: 15 + * This product includes software developed by the University of 16 + * California, Berkeley and its contributors. 17 + * 4. Neither the name of the University nor the names of its contributors 18 + * may be used to endorse or promote products derived from this software 19 + * without specific prior written permission. 20 + * 21 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 + * SUCH DAMAGE. 32 + */ 33 + 34 + /* 35 + * Copyright (c) 1996-1999 by Internet Software Consortium. 36 + * 37 + * Permission to use, copy, modify, and distribute this software for any 38 + * purpose with or without fee is hereby granted, provided that the above 39 + * copyright notice and this permission notice appear in all copies. 40 + * 41 + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 42 + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 43 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 44 + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 45 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 46 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 47 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 48 + * SOFTWARE. 49 + */ 50 + 51 + /* 52 + * $Id: nameser.h,v 1.1 2006/03/01 19:01:36 majka Exp $ 53 + */ 54 + 55 + #ifndef _NAMESER_9_H_ 56 + #define _NAMESER_9_H_ 57 + 58 + #ifdef BIND_8_COMPAT 59 + #include <arpa/nameser_compat.h> 60 + #endif 61 + 62 + #include <sys/param.h> 63 + #if (!defined(BSD)) || (BSD < 199306) 64 + # include <sys/bitypes.h> 65 + #else 66 + # include <sys/types.h> 67 + #endif 68 + #include <sys/cdefs.h> 69 + 70 + /* 71 + * Revision information. This is the release date in YYYYMMDD format. 72 + * It can change every day so the right thing to do with it is use it 73 + * in preprocessor commands such as "#if (__NAMESER > 19931104)". Do not 74 + * compare for equality; rather, use it to determine whether your libbind.a 75 + * contains a new enough lib/nameser/ to support the feature you need. 76 + */ 77 + 78 + #define __NAMESER 19991006 /* New interface version stamp. */ 79 + 80 + /* 81 + * Define constants based on RFC 883, RFC 1034, RFC 1035 82 + */ 83 + #define NS_PACKETSZ 512 /* maximum packet size */ 84 + #define NS_MAXDNAME 1025 /* maximum domain name */ 85 + #define NS_MAXCDNAME 255 /* maximum compressed domain name */ 86 + #define NS_MAXLABEL 63 /* maximum length of domain label */ 87 + #define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ 88 + #define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ 89 + #define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ 90 + #define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */ 91 + #define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */ 92 + #define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */ 93 + #define NS_INADDRSZ 4 /* IPv4 T_A */ 94 + #define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */ 95 + #define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ 96 + #define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ 97 + 98 + /* 99 + * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord() 100 + * in synch with it. 101 + */ 102 + #define ns_sect res_9_ns_sect 103 + typedef enum __ns_sect { 104 + ns_s_qd = 0, /* Query: Question. */ 105 + ns_s_zn = 0, /* Update: Zone. */ 106 + ns_s_an = 1, /* Query: Answer. */ 107 + ns_s_pr = 1, /* Update: Prerequisites. */ 108 + ns_s_ns = 2, /* Query: Name servers. */ 109 + ns_s_ud = 2, /* Update: Update. */ 110 + ns_s_ar = 3, /* Query|Update: Additional records. */ 111 + ns_s_max = 4 112 + } ns_sect; 113 + 114 + /* 115 + * This is a message handle. It is caller allocated and has no dynamic data. 116 + * This structure is intended to be opaque to all but ns_parse.c, thus the 117 + * leading _'s on the member names. Use the accessor functions, not the _'s. 118 + */ 119 + #define ns_msg res_9_ns_msg 120 + typedef struct __ns_msg { 121 + const u_char *_msg, *_eom; 122 + u_int16_t _id, _flags, _counts[ns_s_max]; 123 + const u_char *_sections[ns_s_max]; 124 + ns_sect _sect; 125 + int _rrnum; 126 + const u_char *_msg_ptr; 127 + } ns_msg; 128 + 129 + /* Private data structure - do not use from outside library. */ 130 + #define _ns_flagdata _res_9_ns_flagdata 131 + struct _ns_flagdata { int mask, shift; }; 132 + extern struct _ns_flagdata _ns_flagdata[]; 133 + 134 + /* Accessor macros - this is part of the public interface. */ 135 + 136 + #define ns_msg_id(handle) ((handle)._id + 0) 137 + #define ns_msg_base(handle) ((handle)._msg + 0) 138 + #define ns_msg_end(handle) ((handle)._eom + 0) 139 + #define ns_msg_size(handle) ((handle)._eom - (handle)._msg) 140 + #define ns_msg_count(handle, section) ((handle)._counts[section] + 0) 141 + 142 + /* 143 + * This is a parsed record. It is caller allocated and has no dynamic data. 144 + */ 145 + #define ns_rr res_9_ns_rr 146 + 147 + typedef struct __ns_rr { 148 + char name[NS_MAXDNAME]; 149 + u_int16_t type; 150 + u_int16_t rr_class; 151 + u_int32_t ttl; 152 + u_int16_t rdlength; 153 + const u_char * rdata; 154 + } ns_rr; 155 + 156 + /* Accessor macros - this is part of the public interface. */ 157 + #define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".") 158 + #define ns_rr_type(rr) ((ns_type)((rr).type + 0)) 159 + #define ns_rr_class(rr) ((ns_class)((rr).rr_class + 0)) 160 + #define ns_rr_ttl(rr) ((rr).ttl + 0) 161 + #define ns_rr_rdlen(rr) ((rr).rdlength + 0) 162 + #define ns_rr_rdata(rr) ((rr).rdata + 0) 163 + 164 + /* 165 + * These don't have to be in the same order as in the packet flags word, 166 + * and they can even overlap in some cases, but they will need to be kept 167 + * in synch with ns_parse.c:ns_flagdata[]. 168 + */ 169 + #define ns_flag res_9_ns_flag 170 + typedef enum __ns_flag { 171 + ns_f_qr, /* Question/Response. */ 172 + ns_f_opcode, /* Operation code. */ 173 + ns_f_aa, /* Authoritative Answer. */ 174 + ns_f_tc, /* Truncation occurred. */ 175 + ns_f_rd, /* Recursion Desired. */ 176 + ns_f_ra, /* Recursion Available. */ 177 + ns_f_z, /* MBZ. */ 178 + ns_f_ad, /* Authentic Data (DNSSEC). */ 179 + ns_f_cd, /* Checking Disabled (DNSSEC). */ 180 + ns_f_rcode, /* Response code. */ 181 + ns_f_max 182 + } ns_flag; 183 + 184 + /* 185 + * Currently defined opcodes. 186 + */ 187 + #define ns_opcode res_9_ns_opcode 188 + typedef enum __ns_opcode { 189 + ns_o_query = 0, /* Standard query. */ 190 + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ 191 + ns_o_status = 2, /* Name server status query (unsupported). */ 192 + /* Opcode 3 is undefined/reserved. */ 193 + ns_o_notify = 4, /* Zone change notification. */ 194 + ns_o_update = 5, /* Zone update message. */ 195 + ns_o_max = 6 196 + } ns_opcode; 197 + 198 + /* 199 + * Currently defined response codes. 200 + */ 201 + #define ns_rcode res_9_ns_rcode 202 + typedef enum __ns_rcode { 203 + ns_r_noerror = 0, /* No error occurred. */ 204 + ns_r_formerr = 1, /* Format error. */ 205 + ns_r_servfail = 2, /* Server failure. */ 206 + ns_r_nxdomain = 3, /* Name error. */ 207 + ns_r_notimpl = 4, /* Unimplemented. */ 208 + ns_r_refused = 5, /* Operation refused. */ 209 + /* these are for BIND_UPDATE */ 210 + ns_r_yxdomain = 6, /* Name exists */ 211 + ns_r_yxrrset = 7, /* RRset exists */ 212 + ns_r_nxrrset = 8, /* RRset does not exist */ 213 + ns_r_notauth = 9, /* Not authoritative for zone */ 214 + ns_r_notzone = 10, /* Zone of record different from zone section */ 215 + ns_r_max = 11, 216 + /* The following are EDNS extended rcodes */ 217 + ns_r_badvers = 16, 218 + /* The following are TSIG errors */ 219 + ns_r_badsig = 16, 220 + ns_r_badkey = 17, 221 + ns_r_badtime = 18 222 + } ns_rcode; 223 + 224 + /* BIND_UPDATE */ 225 + #define ns_update_operation res_9_ns_update_operation 226 + typedef enum __ns_update_operation { 227 + ns_uop_delete = 0, 228 + ns_uop_add = 1, 229 + ns_uop_max = 2 230 + } ns_update_operation; 231 + 232 + /* 233 + * This structure is used for TSIG authenticated messages 234 + */ 235 + #define ns_tsig_key res_9_ns_tsig_key 236 + struct ns_tsig_key { 237 + char name[NS_MAXDNAME], alg[NS_MAXDNAME]; 238 + unsigned char *data; 239 + int len; 240 + }; 241 + typedef struct ns_tsig_key ns_tsig_key; 242 + 243 + /* 244 + * This structure is used for TSIG authenticated TCP messages 245 + */ 246 + #define ns_tcp_tsig_state res_9_ns_tcp_tsig_state 247 + struct ns_tcp_tsig_state { 248 + int counter; 249 + struct dst_key *key; 250 + void *ctx; 251 + unsigned char sig[NS_PACKETSZ]; 252 + int siglen; 253 + }; 254 + typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; 255 + 256 + #define NS_TSIG_FUDGE 300 257 + #define NS_TSIG_TCP_COUNT 100 258 + #define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" 259 + 260 + #define NS_TSIG_ERROR_NO_TSIG -10 261 + #define NS_TSIG_ERROR_NO_SPACE -11 262 + #define NS_TSIG_ERROR_FORMERR -12 263 + 264 + /* 265 + * Currently defined type values for resources and queries. 266 + */ 267 + #define ns_typw res_9_ns_type 268 + typedef enum __ns_type { 269 + ns_t_invalid = 0, /* Cookie. */ 270 + ns_t_a = 1, /* Host address. */ 271 + ns_t_ns = 2, /* Authoritative server. */ 272 + ns_t_md = 3, /* Mail destination. */ 273 + ns_t_mf = 4, /* Mail forwarder. */ 274 + ns_t_cname = 5, /* Canonical name. */ 275 + ns_t_soa = 6, /* Start of authority zone. */ 276 + ns_t_mb = 7, /* Mailbox domain name. */ 277 + ns_t_mg = 8, /* Mail group member. */ 278 + ns_t_mr = 9, /* Mail rename name. */ 279 + ns_t_null = 10, /* Null resource record. */ 280 + ns_t_wks = 11, /* Well known service. */ 281 + ns_t_ptr = 12, /* Domain name pointer. */ 282 + ns_t_hinfo = 13, /* Host information. */ 283 + ns_t_minfo = 14, /* Mailbox information. */ 284 + ns_t_mx = 15, /* Mail routing information. */ 285 + ns_t_txt = 16, /* Text strings. */ 286 + ns_t_rp = 17, /* Responsible person. */ 287 + ns_t_afsdb = 18, /* AFS cell database. */ 288 + ns_t_x25 = 19, /* X_25 calling address. */ 289 + ns_t_isdn = 20, /* ISDN calling address. */ 290 + ns_t_rt = 21, /* Router. */ 291 + ns_t_nsap = 22, /* NSAP address. */ 292 + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ 293 + ns_t_sig = 24, /* Security signature. */ 294 + ns_t_key = 25, /* Security key. */ 295 + ns_t_px = 26, /* X.400 mail mapping. */ 296 + ns_t_gpos = 27, /* Geographical position (withdrawn). */ 297 + ns_t_aaaa = 28, /* Ip6 Address. */ 298 + ns_t_loc = 29, /* Location Information. */ 299 + ns_t_nxt = 30, /* Next domain (security). */ 300 + ns_t_eid = 31, /* Endpoint identifier. */ 301 + ns_t_nimloc = 32, /* Nimrod Locator. */ 302 + ns_t_srv = 33, /* Server Selection. */ 303 + ns_t_atma = 34, /* ATM Address */ 304 + ns_t_naptr = 35, /* Naming Authority PoinTeR */ 305 + ns_t_kx = 36, /* Key Exchange */ 306 + ns_t_cert = 37, /* Certification record */ 307 + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ 308 + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ 309 + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ 310 + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ 311 + ns_t_tkey = 249, /* Transaction key */ 312 + ns_t_tsig = 250, /* Transaction signature. */ 313 + ns_t_ixfr = 251, /* Incremental zone transfer. */ 314 + ns_t_axfr = 252, /* Transfer zone of authority. */ 315 + ns_t_mailb = 253, /* Transfer mailbox records. */ 316 + ns_t_maila = 254, /* Transfer mail agent records. */ 317 + ns_t_any = 255, /* Wildcard match. */ 318 + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ 319 + ns_t_max = 65536 320 + } ns_type; 321 + 322 + /* Exclusively a QTYPE? (not also an RTYPE) */ 323 + #define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ 324 + (t) == ns_t_mailb || (t) == ns_t_maila) 325 + /* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */ 326 + #define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) 327 + /* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */ 328 + #define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) 329 + #define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) 330 + #define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ 331 + (t) == ns_t_zxfr) 332 + 333 + /* 334 + * Values for class field 335 + */ 336 + #define ns_class res_9_ns_class 337 + typedef enum __ns_class { 338 + ns_c_invalid = 0, /* Cookie. */ 339 + ns_c_in = 1, /* Internet. */ 340 + ns_c_2 = 2, /* unallocated/unsupported. */ 341 + ns_c_chaos = 3, /* MIT Chaos-net. */ 342 + ns_c_hs = 4, /* MIT Hesiod. */ 343 + /* Query class values which do not appear in resource records */ 344 + ns_c_none = 254, /* for prereq. sections in update requests */ 345 + ns_c_any = 255, /* Wildcard match. */ 346 + ns_c_max = 65536 347 + } ns_class; 348 + 349 + /* DNSSEC constants. */ 350 + 351 + #define ns_key_types res_9_ns_key_types 352 + typedef enum __ns_key_types { 353 + ns_kt_rsa = 1, /* key type RSA/MD5 */ 354 + ns_kt_dh = 2, /* Diffie Hellman */ 355 + ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */ 356 + ns_kt_private = 254 /* Private key type starts with OID */ 357 + } ns_key_types; 358 + 359 + #define ns_cert_types res_9_ns_cert_types 360 + typedef enum __ns_cert_types { 361 + cert_t_pkix = 1, /* PKIX (X.509v3) */ 362 + cert_t_spki = 2, /* SPKI */ 363 + cert_t_pgp = 3, /* PGP */ 364 + cert_t_url = 253, /* URL private type */ 365 + cert_t_oid = 254 /* OID private type */ 366 + } ns_cert_types; 367 + 368 + /* Flags field of the KEY RR rdata. */ 369 + #define NS_KEY_TYPEMASK 0xC000 /* Mask for "type" bits */ 370 + #define NS_KEY_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ 371 + #define NS_KEY_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ 372 + #define NS_KEY_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ 373 + #define NS_KEY_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ 374 + /* The type bits can also be interpreted independently, as single bits: */ 375 + #define NS_KEY_NO_AUTH 0x8000 /* Key unusable for authentication */ 376 + #define NS_KEY_NO_CONF 0x4000 /* Key unusable for confidentiality */ 377 + #define NS_KEY_RESERVED2 0x2000 /* Security is *mandatory* if bit=0 */ 378 + #define NS_KEY_EXTENDED_FLAGS 0x1000 /* reserved - must be zero */ 379 + #define NS_KEY_RESERVED4 0x0800 /* reserved - must be zero */ 380 + #define NS_KEY_RESERVED5 0x0400 /* reserved - must be zero */ 381 + #define NS_KEY_NAME_TYPE 0x0300 /* these bits determine the type */ 382 + #define NS_KEY_NAME_USER 0x0000 /* key is assoc. with user */ 383 + #define NS_KEY_NAME_ENTITY 0x0200 /* key is assoc. with entity eg host */ 384 + #define NS_KEY_NAME_ZONE 0x0100 /* key is zone key */ 385 + #define NS_KEY_NAME_RESERVED 0x0300 /* reserved meaning */ 386 + #define NS_KEY_RESERVED8 0x0080 /* reserved - must be zero */ 387 + #define NS_KEY_RESERVED9 0x0040 /* reserved - must be zero */ 388 + #define NS_KEY_RESERVED10 0x0020 /* reserved - must be zero */ 389 + #define NS_KEY_RESERVED11 0x0010 /* reserved - must be zero */ 390 + #define NS_KEY_SIGNATORYMASK 0x000F /* key can sign RR's of same name */ 391 + #define NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \ 392 + NS_KEY_RESERVED4 | \ 393 + NS_KEY_RESERVED5 | \ 394 + NS_KEY_RESERVED8 | \ 395 + NS_KEY_RESERVED9 | \ 396 + NS_KEY_RESERVED10 | \ 397 + NS_KEY_RESERVED11 ) 398 + #define NS_KEY_RESERVED_BITMASK2 0xFFFF /* no bits defined here */ 399 + 400 + /* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ 401 + #define NS_ALG_MD5RSA 1 /* MD5 with RSA */ 402 + #define NS_ALG_DH 2 /* Diffie Hellman KEY */ 403 + #define NS_ALG_DSA 3 /* DSA KEY */ 404 + #define NS_ALG_DSS NS_ALG_DSA 405 + #define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ 406 + #define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ 407 + 408 + /* Protocol values */ 409 + /* value 0 is reserved */ 410 + #define NS_KEY_PROT_TLS 1 411 + #define NS_KEY_PROT_EMAIL 2 412 + #define NS_KEY_PROT_DNSSEC 3 413 + #define NS_KEY_PROT_IPSEC 4 414 + #define NS_KEY_PROT_ANY 255 415 + 416 + /* Signatures */ 417 + #define NS_MD5RSA_MIN_BITS 512 /* Size of a mod or exp in bits */ 418 + #define NS_MD5RSA_MAX_BITS 2552 419 + /* Total of binary mod and exp */ 420 + #define NS_MD5RSA_MAX_BYTES ((NS_MD5RSA_MAX_BITS+7/8)*2+3) 421 + /* Max length of text sig block */ 422 + #define NS_MD5RSA_MAX_BASE64 (((NS_MD5RSA_MAX_BYTES+2)/3)*4) 423 + #define NS_MD5RSA_MIN_SIZE ((NS_MD5RSA_MIN_BITS+7)/8) 424 + #define NS_MD5RSA_MAX_SIZE ((NS_MD5RSA_MAX_BITS+7)/8) 425 + 426 + #define NS_DSA_SIG_SIZE 41 427 + #define NS_DSA_MIN_SIZE 213 428 + #define NS_DSA_MAX_BYTES 405 429 + 430 + /* Offsets into SIG record rdata to find various values */ 431 + #define NS_SIG_TYPE 0 /* Type flags */ 432 + #define NS_SIG_ALG 2 /* Algorithm */ 433 + #define NS_SIG_LABELS 3 /* How many labels in name */ 434 + #define NS_SIG_OTTL 4 /* Original TTL */ 435 + #define NS_SIG_EXPIR 8 /* Expiration time */ 436 + #define NS_SIG_SIGNED 12 /* Signature time */ 437 + #define NS_SIG_FOOT 16 /* Key footprint */ 438 + #define NS_SIG_SIGNER 18 /* Domain name of who signed it */ 439 + 440 + /* How RR types are represented as bit-flags in NXT records */ 441 + #define NS_NXT_BITS 8 442 + #define NS_NXT_BIT_SET( n,p) (p[(n)/NS_NXT_BITS] |= (0x80>>((n)%NS_NXT_BITS))) 443 + #define NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS))) 444 + #define NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] & (0x80>>((n)%NS_NXT_BITS))) 445 + #define NS_NXT_MAX 127 446 + 447 + /* 448 + * EDNS0 extended flags, host order. 449 + */ 450 + #define NS_OPT_DNSSEC_OK 0x8000U 451 + 452 + /* 453 + * Inline versions of get/put short/long. Pointer is advanced. 454 + */ 455 + #define NS_GET16(s, cp) do { \ 456 + register const u_char *t_cp = (const u_char *)(cp); \ 457 + (s) = ((u_int16_t)t_cp[0] << 8) \ 458 + | ((u_int16_t)t_cp[1]) \ 459 + ; \ 460 + (cp) += NS_INT16SZ; \ 461 + } while (0) 462 + 463 + #define NS_GET32(l, cp) do { \ 464 + register const u_char *t_cp = (const u_char *)(cp); \ 465 + (l) = ((u_int32_t)t_cp[0] << 24) \ 466 + | ((u_int32_t)t_cp[1] << 16) \ 467 + | ((u_int32_t)t_cp[2] << 8) \ 468 + | ((u_int32_t)t_cp[3]) \ 469 + ; \ 470 + (cp) += NS_INT32SZ; \ 471 + } while (0) 472 + 473 + #define NS_PUT16(s, cp) do { \ 474 + register u_int16_t t_s = (u_int16_t)(s); \ 475 + register u_char *t_cp = (u_char *)(cp); \ 476 + *t_cp++ = t_s >> 8; \ 477 + *t_cp = t_s; \ 478 + (cp) += NS_INT16SZ; \ 479 + } while (0) 480 + 481 + #define NS_PUT32(l, cp) do { \ 482 + register u_int32_t t_l = (u_int32_t)(l); \ 483 + register u_char *t_cp = (u_char *)(cp); \ 484 + *t_cp++ = t_l >> 24; \ 485 + *t_cp++ = t_l >> 16; \ 486 + *t_cp++ = t_l >> 8; \ 487 + *t_cp = t_l; \ 488 + (cp) += NS_INT32SZ; \ 489 + } while (0) 490 + 491 + /* 492 + * ANSI C identifier hiding for bind's lib/nameser. 493 + */ 494 + #define ns_msg_getflag res_9_ns_msg_getflag 495 + #define ns_get16 res_9_ns_get16 496 + #define ns_get32 res_9_ns_get32 497 + #define ns_put16 res_9_ns_put16 498 + #define ns_put32 res_9_ns_put32 499 + #define ns_initparse res_9_ns_initparse 500 + #define ns_skiprr res_9_ns_skiprr 501 + #define ns_parserr res_9_ns_parserr 502 + #define ns_sprintrr res_9_ns_sprintrr 503 + #define ns_sprintrrf res_9_ns_sprintrrf 504 + #define ns_format_ttl res_9_ns_format_ttl 505 + #define ns_parse_ttl res_9_ns_parse_ttl 506 + #define ns_datetosecs res_9_ns_datetosecs 507 + #define ns_name_ntol res_9_ns_name_ntol 508 + #define ns_name_ntop res_9_ns_name_ntop 509 + #define ns_name_pton res_9_ns_name_pton 510 + #define ns_name_unpack res_9_ns_name_unpack 511 + #define ns_name_pack res_9_ns_name_pack 512 + #define ns_name_compress res_9_ns_name_compress 513 + #define ns_name_uncompress res_9_ns_name_uncompress 514 + #define ns_name_skip res_9_ns_name_skip 515 + #define ns_name_rollback res_9_ns_name_rollback 516 + #define ns_sign res_9_ns_sign 517 + #define ns_sign2 res_9_ns_sign2 518 + #define ns_sign_tcp res_9_ns_sign_tcp 519 + #define ns_sign_tcp2 res_9_ns_sign_tcp2 520 + #define ns_sign_tcp_init res_9_ns_sign_tcp_init 521 + #define ns_find_tsig res_9_ns_find_tsig 522 + #define ns_verify res_9_ns_verify 523 + #define ns_verify_tcp res_9_ns_verify_tcp 524 + #define ns_verify_tcp_init res_9_ns_verify_tcp_init 525 + #define ns_samedomain res_9_ns_samedomain 526 + #define ns_subdomain res_9_ns_subdomain 527 + #define ns_makecanon res_9_ns_makecanon 528 + #define ns_samename res_9_ns_samename 529 + 530 + __BEGIN_DECLS 531 + int ns_msg_getflag __P((ns_msg, int)); 532 + u_int ns_get16 __P((const u_char *)); 533 + u_long ns_get32 __P((const u_char *)); 534 + void ns_put16 __P((u_int, u_char *)); 535 + void ns_put32 __P((u_long, u_char *)); 536 + int ns_initparse __P((const u_char *, int, ns_msg *)); 537 + int ns_skiprr __P((const u_char *, const u_char *, ns_sect, int)); 538 + int ns_parserr __P((ns_msg *, ns_sect, int, ns_rr *)); 539 + int ns_sprintrr __P((const ns_msg *, const ns_rr *, 540 + const char *, const char *, char *, size_t)); 541 + int ns_sprintrrf __P((const u_char *, size_t, const char *, 542 + ns_class, ns_type, u_long, const u_char *, 543 + size_t, const char *, const char *, 544 + char *, size_t)); 545 + int ns_format_ttl __P((u_long, char *, size_t)); 546 + int ns_parse_ttl __P((const char *, u_long *)); 547 + u_int32_t ns_datetosecs __P((const char *cp, int *errp)); 548 + int ns_name_ntol __P((const u_char *, u_char *, size_t)); 549 + int ns_name_ntop __P((const u_char *, char *, size_t)); 550 + int ns_name_pton __P((const char *, u_char *, size_t)); 551 + int ns_name_unpack __P((const u_char *, const u_char *, 552 + const u_char *, u_char *, size_t)); 553 + int ns_name_pack __P((const u_char *, u_char *, int, 554 + const u_char **, const u_char **)); 555 + int ns_name_uncompress __P((const u_char *, const u_char *, 556 + const u_char *, char *, size_t)); 557 + int ns_name_compress __P((const char *, u_char *, size_t, 558 + const u_char **, const u_char **)); 559 + int ns_name_skip __P((const u_char **, const u_char *)); 560 + void ns_name_rollback __P((const u_char *, const u_char **, 561 + const u_char **)); 562 + int ns_sign __P((u_char *, int *, int, int, void *, 563 + const u_char *, int, u_char *, int *, time_t)); 564 + int ns_sign2 __P((u_char *, int *, int, int, void *, 565 + const u_char *, int, u_char *, int *, time_t, 566 + u_char **, u_char **)); 567 + int ns_sign_tcp __P((u_char *, int *, int, int, 568 + ns_tcp_tsig_state *, int)); 569 + int ns_sign_tcp2 __P((u_char *, int *, int, int, 570 + ns_tcp_tsig_state *, int, 571 + u_char **, u_char **)); 572 + int ns_sign_tcp_init __P((void *, const u_char *, int, 573 + ns_tcp_tsig_state *)); 574 + u_char *ns_find_tsig __P((u_char *, u_char *)); 575 + int ns_verify __P((u_char *, int *, void *, 576 + const u_char *, int, u_char *, int *, 577 + time_t *, int)); 578 + int ns_verify_tcp __P((u_char *, int *, ns_tcp_tsig_state *, int)); 579 + int ns_verify_tcp_init __P((void *, const u_char *, int, 580 + ns_tcp_tsig_state *)); 581 + int ns_samedomain __P((const char *, const char *)); 582 + int ns_subdomain __P((const char *, const char *)); 583 + int ns_makecanon __P((const char *, char *, size_t)); 584 + int ns_samename __P((const char *, const char *)); 585 + __END_DECLS 586 + 587 + #endif /* !_NAMESER_9_H_ */
+418
platform-include/net/bpf.h
··· 1 + /* 2 + * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1990, 1991, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * This code is derived from the Stanford/CMU enet packet filter, 33 + * (net/enet.c) distributed as part of 4.3BSD, and code contributed 34 + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 35 + * Berkeley Laboratory. 36 + * 37 + * Redistribution and use in source and binary forms, with or without 38 + * modification, are permitted provided that the following conditions 39 + * are met: 40 + * 1. Redistributions of source code must retain the above copyright 41 + * notice, this list of conditions and the following disclaimer. 42 + * 2. Redistributions in binary form must reproduce the above copyright 43 + * notice, this list of conditions and the following disclaimer in the 44 + * documentation and/or other materials provided with the distribution. 45 + * 3. All advertising materials mentioning features or use of this software 46 + * must display the following acknowledgement: 47 + * This product includes software developed by the University of 48 + * California, Berkeley and its contributors. 49 + * 4. Neither the name of the University nor the names of its contributors 50 + * may be used to endorse or promote products derived from this software 51 + * without specific prior written permission. 52 + * 53 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 54 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 57 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63 + * SUCH DAMAGE. 64 + * 65 + * @(#)bpf.h 8.1 (Berkeley) 6/10/93 66 + * @(#)bpf.h 1.34 (LBL) 6/16/96 67 + * 68 + * $FreeBSD: src/sys/net/bpf.h,v 1.21.2.3 2001/08/01 00:23:13 fenner Exp $ 69 + */ 70 + /* 71 + * NOTICE: This file was modified by SPARTA, Inc. in 2006 to introduce 72 + * support for mandatory and extensible security protections. This notice 73 + * is included in support of clause 2.2 (b) of the Apple Public License, 74 + * Version 2.0. 75 + */ 76 + 77 + #ifndef _NET_BPF_H_ 78 + #define _NET_BPF_H_ 79 + #include <sys/param.h> 80 + #include <sys/appleapiopts.h> 81 + #include <sys/types.h> 82 + #include <sys/time.h> 83 + #include <sys/cdefs.h> 84 + 85 + 86 + /* BSD style release date */ 87 + #define BPF_RELEASE 199606 88 + 89 + typedef int32_t bpf_int32; 90 + typedef u_int32_t bpf_u_int32; 91 + 92 + /* 93 + * Alignment macros. BPF_WORDALIGN rounds up to the next 94 + * even multiple of BPF_ALIGNMENT. 95 + */ 96 + #define BPF_ALIGNMENT sizeof(int32_t) 97 + #define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1)) 98 + 99 + #define BPF_MAXINSNS 512 100 + #define BPF_MAXBUFSIZE 0x80000 101 + #define BPF_MINBUFSIZE 32 102 + 103 + /* 104 + * Structure for BIOCSETF. 105 + */ 106 + struct bpf_program { 107 + u_int bf_len; 108 + struct bpf_insn *bf_insns; 109 + }; 110 + 111 + 112 + /* 113 + * Struct returned by BIOCGSTATS. 114 + */ 115 + struct bpf_stat { 116 + u_int bs_recv; /* number of packets received */ 117 + u_int bs_drop; /* number of packets dropped */ 118 + }; 119 + 120 + /* 121 + * Struct return by BIOCVERSION. This represents the version number of 122 + * the filter language described by the instruction encodings below. 123 + * bpf understands a program iff kernel_major == filter_major && 124 + * kernel_minor >= filter_minor, that is, if the value returned by the 125 + * running kernel has the same major number and a minor number equal 126 + * equal to or less than the filter being downloaded. Otherwise, the 127 + * results are undefined, meaning an error may be returned or packets 128 + * may be accepted haphazardly. 129 + * It has nothing to do with the source code version. 130 + */ 131 + struct bpf_version { 132 + u_short bv_major; 133 + u_short bv_minor; 134 + }; 135 + #if defined(__LP64__) 136 + #define __need_struct_timeval32 137 + #include <sys/_structs.h> 138 + #define BPF_TIMEVAL timeval32 139 + #else 140 + #define BPF_TIMEVAL timeval 141 + #endif /* __LP64__ */ 142 + /* Current version number of filter architecture. */ 143 + #define BPF_MAJOR_VERSION 1 144 + #define BPF_MINOR_VERSION 1 145 + 146 + #define BIOCGBLEN _IOR('B',102, u_int) 147 + #define BIOCSBLEN _IOWR('B',102, u_int) 148 + #define BIOCSETF _IOW('B',103, struct bpf_program) 149 + #define BIOCFLUSH _IO('B',104) 150 + #define BIOCPROMISC _IO('B',105) 151 + #define BIOCGDLT _IOR('B',106, u_int) 152 + #define BIOCGETIF _IOR('B',107, struct ifreq) 153 + #define BIOCSETIF _IOW('B',108, struct ifreq) 154 + #define BIOCSRTIMEOUT _IOW('B',109, struct timeval) 155 + #define BIOCGRTIMEOUT _IOR('B',110, struct timeval) 156 + #define BIOCGSTATS _IOR('B',111, struct bpf_stat) 157 + #define BIOCIMMEDIATE _IOW('B',112, u_int) 158 + #define BIOCVERSION _IOR('B',113, struct bpf_version) 159 + #define BIOCGRSIG _IOR('B',114, u_int) 160 + #define BIOCSRSIG _IOW('B',115, u_int) 161 + #define BIOCGHDRCMPLT _IOR('B',116, u_int) 162 + #define BIOCSHDRCMPLT _IOW('B',117, u_int) 163 + #define BIOCGSEESENT _IOR('B',118, u_int) 164 + #define BIOCSSEESENT _IOW('B',119, u_int) 165 + #define BIOCSDLT _IOW('B',120, u_int) 166 + #define BIOCGDLTLIST _IOWR('B',121, struct bpf_dltlist) 167 + 168 + /* 169 + * Structure prepended to each packet. 170 + */ 171 + struct bpf_hdr { 172 + struct BPF_TIMEVAL bh_tstamp; /* time stamp */ 173 + bpf_u_int32 bh_caplen; /* length of captured portion */ 174 + bpf_u_int32 bh_datalen; /* original length of packet */ 175 + u_short bh_hdrlen; /* length of bpf header (this struct 176 + plus alignment padding) */ 177 + }; 178 + 179 + /* 180 + * Data-link level type codes. 181 + */ 182 + #define DLT_NULL 0 /* no link-layer encapsulation */ 183 + #define DLT_EN10MB 1 /* Ethernet (10Mb) */ 184 + #define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */ 185 + #define DLT_AX25 3 /* Amateur Radio AX.25 */ 186 + #define DLT_PRONET 4 /* Proteon ProNET Token Ring */ 187 + #define DLT_CHAOS 5 /* Chaos */ 188 + #define DLT_IEEE802 6 /* IEEE 802 Networks */ 189 + #define DLT_ARCNET 7 /* ARCNET */ 190 + #define DLT_SLIP 8 /* Serial Line IP */ 191 + #define DLT_PPP 9 /* Point-to-point Protocol */ 192 + #define DLT_FDDI 10 /* FDDI */ 193 + #define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */ 194 + #define DLT_RAW 12 /* raw IP */ 195 + 196 + /* 197 + * These are values from BSD/OS's "bpf.h". 198 + * These are not the same as the values from the traditional libpcap 199 + * "bpf.h"; however, these values shouldn't be generated by any 200 + * OS other than BSD/OS, so the correct values to use here are the 201 + * BSD/OS values. 202 + * 203 + * Platforms that have already assigned these values to other 204 + * DLT_ codes, however, should give these codes the values 205 + * from that platform, so that programs that use these codes will 206 + * continue to compile - even though they won't correctly read 207 + * files of these types. 208 + */ 209 + #define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */ 210 + #define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */ 211 + 212 + #define DLT_PFSYNC 18 /* Packet filter state syncing */ 213 + #define DLT_ATM_CLIP 19 /* Linux Classical-IP over ATM */ 214 + 215 + /* 216 + * This value is defined by NetBSD; other platforms should refrain from 217 + * using it for other purposes, so that NetBSD savefiles with a link 218 + * type of 50 can be read as this type on all platforms. 219 + */ 220 + #define DLT_PPP_SERIAL 50 /* PPP over serial with HDLC encapsulation */ 221 + 222 + /* 223 + * This value was defined by libpcap 0.5; platforms that have defined 224 + * it with a different value should define it here with that value - 225 + * a link type of 104 in a save file will be mapped to DLT_C_HDLC, 226 + * whatever value that happens to be, so programs will correctly 227 + * handle files with that link type regardless of the value of 228 + * DLT_C_HDLC. 229 + * 230 + * The name DLT_C_HDLC was used by BSD/OS; we use that name for source 231 + * compatibility with programs written for BSD/OS. 232 + * 233 + * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well, 234 + * for source compatibility with programs written for libpcap 0.5. 235 + */ 236 + #define DLT_C_HDLC 104 /* Cisco HDLC */ 237 + #define DLT_CHDLC DLT_C_HDLC 238 + 239 + /* 240 + * Reserved for future use. 241 + * Do not pick other numerical value for these unless you have also 242 + * picked up the tcpdump.org top-of-CVS-tree version of "savefile.c", 243 + * which will arrange that capture files for these DLT_ types have 244 + * the same "network" value on all platforms, regardless of what 245 + * value is chosen for their DLT_ type (thus allowing captures made 246 + * on one platform to be read on other platforms, even if the two 247 + * platforms don't use the same numerical values for all DLT_ types). 248 + */ 249 + #define DLT_IEEE802_11 105 /* IEEE 802.11 wireless */ 250 + 251 + /* 252 + * Values between 106 and 107 are used in capture file headers as 253 + * link-layer types corresponding to DLT_ types that might differ 254 + * between platforms; don't use those values for new DLT_ new types. 255 + */ 256 + 257 + /* 258 + * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except 259 + * that the AF_ type in the link-layer header is in network byte order. 260 + * 261 + * OpenBSD defines it as 12, but that collides with DLT_RAW, so we 262 + * define it as 108 here. If OpenBSD picks up this file, it should 263 + * define DLT_LOOP as 12 in its version, as per the comment above - 264 + * and should not use 108 for any purpose. 265 + */ 266 + #define DLT_LOOP 108 267 + 268 + /* 269 + * Values between 109 and 112 are used in capture file headers as 270 + * link-layer types corresponding to DLT_ types that might differ 271 + * between platforms; don't use those values for new DLT_ new types. 272 + */ 273 + 274 + /* 275 + * This is for Linux cooked sockets. 276 + */ 277 + #define DLT_LINUX_SLL 113 278 + 279 + /* 280 + * For use in capture-file headers as a link-layer type corresponding 281 + * to OpenBSD PF (Packet Filter) log. 282 + */ 283 + #define DLT_PFLOG 117 284 + 285 + /* 286 + * BSD header for 802.11 plus a number of bits of link-layer information 287 + * including radio information. 288 + */ 289 + #ifndef DLT_IEEE802_11_RADIO 290 + #define DLT_IEEE802_11_RADIO 127 291 + #endif 292 + 293 + /* 294 + * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund 295 + * <dieter@apple.com>. The header that's presented is an Ethernet-like 296 + * header: 297 + * 298 + * #define FIREWIRE_EUI64_LEN 8 299 + * struct firewire_header { 300 + * u_char firewire_dhost[FIREWIRE_EUI64_LEN]; 301 + * u_char firewire_shost[FIREWIRE_EUI64_LEN]; 302 + * u_short firewire_type; 303 + * }; 304 + * 305 + * with "firewire_type" being an Ethernet type value, rather than, 306 + * for example, raw GASP frames being handed up. 307 + */ 308 + #define DLT_APPLE_IP_OVER_IEEE1394 138 309 + 310 + /* 311 + * For future use with 802.11 captures - defined by AbsoluteValue 312 + * Systems to store a number of bits of link-layer information 313 + * including radio information: 314 + * 315 + * http://www.shaftnet.org/~pizza/software/capturefrm.txt 316 + * 317 + * but it might be used by some non-AVS drivers now or in the 318 + * future. 319 + */ 320 + #define DLT_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */ 321 + 322 + 323 + /* 324 + * The instruction encodings. 325 + */ 326 + /* instruction classes */ 327 + #define BPF_CLASS(code) ((code) & 0x07) 328 + #define BPF_LD 0x00 329 + #define BPF_LDX 0x01 330 + #define BPF_ST 0x02 331 + #define BPF_STX 0x03 332 + #define BPF_ALU 0x04 333 + #define BPF_JMP 0x05 334 + #define BPF_RET 0x06 335 + #define BPF_MISC 0x07 336 + 337 + /* ld/ldx fields */ 338 + #define BPF_SIZE(code) ((code) & 0x18) 339 + #define BPF_W 0x00 340 + #define BPF_H 0x08 341 + #define BPF_B 0x10 342 + #define BPF_MODE(code) ((code) & 0xe0) 343 + #define BPF_IMM 0x00 344 + #define BPF_ABS 0x20 345 + #define BPF_IND 0x40 346 + #define BPF_MEM 0x60 347 + #define BPF_LEN 0x80 348 + #define BPF_MSH 0xa0 349 + 350 + /* alu/jmp fields */ 351 + #define BPF_OP(code) ((code) & 0xf0) 352 + #define BPF_ADD 0x00 353 + #define BPF_SUB 0x10 354 + #define BPF_MUL 0x20 355 + #define BPF_DIV 0x30 356 + #define BPF_OR 0x40 357 + #define BPF_AND 0x50 358 + #define BPF_LSH 0x60 359 + #define BPF_RSH 0x70 360 + #define BPF_NEG 0x80 361 + #define BPF_JA 0x00 362 + #define BPF_JEQ 0x10 363 + #define BPF_JGT 0x20 364 + #define BPF_JGE 0x30 365 + #define BPF_JSET 0x40 366 + #define BPF_SRC(code) ((code) & 0x08) 367 + #define BPF_K 0x00 368 + #define BPF_X 0x08 369 + 370 + /* ret - BPF_K and BPF_X also apply */ 371 + #define BPF_RVAL(code) ((code) & 0x18) 372 + #define BPF_A 0x10 373 + 374 + /* misc */ 375 + #define BPF_MISCOP(code) ((code) & 0xf8) 376 + #define BPF_TAX 0x00 377 + #define BPF_TXA 0x80 378 + 379 + /* 380 + * The instruction data structure. 381 + */ 382 + struct bpf_insn { 383 + u_short code; 384 + u_char jt; 385 + u_char jf; 386 + bpf_u_int32 k; 387 + }; 388 + 389 + /* 390 + * Macros for insn array initializers. 391 + */ 392 + #define BPF_STMT(code, k) { (u_short)(code), 0, 0, k } 393 + #define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k } 394 + 395 + #pragma pack(4) 396 + 397 + /* 398 + * Structure to retrieve available DLTs for the interface. 399 + */ 400 + struct bpf_dltlist { 401 + u_int32_t bfl_len; /* number of bfd_list array */ 402 + union { 403 + u_int32_t *bflu_list; /* array of DLTs */ 404 + u_int64_t bflu_pad; 405 + } bfl_u; 406 + }; 407 + #define bfl_list bfl_u.bflu_list 408 + 409 + #pragma pack() 410 + 411 + 412 + 413 + /* 414 + * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). 415 + */ 416 + #define BPF_MEMWORDS 16 417 + 418 + #endif /* _NET_BPF_H_ */
+30
platform-include/net/dlil.h
··· 1 + /* 2 + * Copyright (c) 1999-2012 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + #ifndef DLIL_H 29 + #define DLIL_H 30 + #endif /* DLIL_H */
+137
platform-include/net/ethernet.h
··· 1 + /* 2 + * Copyright (c) 2000-2010 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Fundamental constants relating to ethernet. 30 + * 31 + */ 32 + 33 + #ifndef _NET_ETHERNET_H_ 34 + #define _NET_ETHERNET_H_ 35 + #include <sys/appleapiopts.h> 36 + #include <sys/types.h> /* u_ types */ 37 + 38 + /* 39 + * The number of bytes in an ethernet (MAC) address. 40 + */ 41 + #define ETHER_ADDR_LEN 6 42 + 43 + /* 44 + * The number of bytes in the type field. 45 + */ 46 + #define ETHER_TYPE_LEN 2 47 + 48 + /* 49 + * The number of bytes in the trailing CRC field. 50 + */ 51 + #define ETHER_CRC_LEN 4 52 + 53 + /* 54 + * The length of the combined header. 55 + */ 56 + #define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) 57 + 58 + /* 59 + * The minimum packet length. 60 + */ 61 + #define ETHER_MIN_LEN 64 62 + 63 + /* 64 + * The maximum packet length. 65 + */ 66 + #define ETHER_MAX_LEN 1518 67 + 68 + /* 69 + * Mbuf adjust factor to force 32-bit alignment of IP header. 70 + * Drivers should do m_adj(m, ETHER_ALIGN) when setting up a 71 + * receive so the upper layers get the IP header properly aligned 72 + * past the 14-byte Ethernet header. 73 + */ 74 + #define ETHER_ALIGN 2 /* driver adjust for IP hdr alignment */ 75 + 76 + /* 77 + * A macro to validate a length with 78 + */ 79 + #define ETHER_IS_VALID_LEN(foo) \ 80 + ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) 81 + 82 + /* 83 + * Structure of a 10Mb/s Ethernet header. 84 + */ 85 + struct ether_header { 86 + u_char ether_dhost[ETHER_ADDR_LEN]; 87 + u_char ether_shost[ETHER_ADDR_LEN]; 88 + u_short ether_type; 89 + }; 90 + 91 + /* 92 + * Structure of a 48-bit Ethernet address. 93 + */ 94 + struct ether_addr { 95 + u_char octet[ETHER_ADDR_LEN]; 96 + }; 97 + 98 + #define ether_addr_octet octet 99 + 100 + #define ETHERTYPE_PUP 0x0200 /* PUP protocol */ 101 + #define ETHERTYPE_IP 0x0800 /* IP protocol */ 102 + #define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ 103 + #define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ 104 + #define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ 105 + #define ETHERTYPE_IPV6 0x86dd /* IPv6 */ 106 + #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */ 107 + #define ETHERTYPE_RSN_PREAUTH 0x88c7 /* 802.11i / RSN Pre-Authentication */ 108 + #define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ 109 + /* XXX - add more useful types here */ 110 + 111 + /* 112 + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have 113 + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed 114 + * by an ETHER type (as given above) and then the (variable-length) header. 115 + */ 116 + #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ 117 + #define ETHERTYPE_NTRAILER 16 118 + 119 + #define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) 120 + #define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) 121 + 122 + 123 + #include <sys/cdefs.h> 124 + 125 + /* 126 + * Ethernet address conversion/parsing routines. 127 + */ 128 + __BEGIN_DECLS 129 + 130 + int ether_hostton(const char *, struct ether_addr *); 131 + int ether_line(const char *, struct ether_addr *, char *); 132 + char *ether_ntoa(const struct ether_addr *); 133 + struct ether_addr *ether_aton(const char *); 134 + int ether_ntohost(char *, const struct ether_addr *); 135 + __END_DECLS 136 + 137 + #endif /* !_NET_ETHERNET_H_ */
+457
platform-include/net/if.h
··· 1 + /* 2 + * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1982, 1986, 1989, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * @(#)if.h 8.1 (Berkeley) 6/10/93 61 + * $FreeBSD: src/sys/net/if.h,v 1.58.2.2 2001/07/24 19:10:18 brooks Exp $ 62 + */ 63 + 64 + #ifndef _NET_IF_H_ 65 + #define _NET_IF_H_ 66 + 67 + #include <sys/cdefs.h> 68 + 69 + #define IF_NAMESIZE 16 70 + 71 + #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) 72 + #include <sys/appleapiopts.h> 73 + #ifdef __APPLE__ 74 + /* 75 + * Define Data-Link event subclass, and associated 76 + * events. 77 + */ 78 + 79 + #define KEV_DL_SUBCLASS 2 80 + 81 + #define KEV_DL_SIFFLAGS 1 82 + #define KEV_DL_SIFMETRICS 2 83 + #define KEV_DL_SIFMTU 3 84 + #define KEV_DL_SIFPHYS 4 85 + #define KEV_DL_SIFMEDIA 5 86 + #define KEV_DL_SIFGENERIC 6 87 + #define KEV_DL_ADDMULTI 7 88 + #define KEV_DL_DELMULTI 8 89 + #define KEV_DL_IF_ATTACHED 9 90 + #define KEV_DL_IF_DETACHING 10 91 + #define KEV_DL_IF_DETACHED 11 92 + #define KEV_DL_LINK_OFF 12 93 + #define KEV_DL_LINK_ON 13 94 + #define KEV_DL_PROTO_ATTACHED 14 95 + #define KEV_DL_PROTO_DETACHED 15 96 + #define KEV_DL_LINK_ADDRESS_CHANGED 16 97 + #define KEV_DL_WAKEFLAGS_CHANGED 17 98 + #define KEV_DL_IF_IDLE_ROUTE_REFCNT 18 99 + #define KEV_DL_IFCAP_CHANGED 19 100 + #define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20 101 + #define KEV_DL_NODE_PRESENCE 21 102 + #define KEV_DL_NODE_ABSENCE 22 103 + #define KEV_DL_MASTER_ELECTED 23 104 + 105 + #include <net/if_var.h> 106 + #include <sys/types.h> 107 + 108 + #endif 109 + 110 + 111 + #define IFF_UP 0x1 /* interface is up */ 112 + #define IFF_BROADCAST 0x2 /* broadcast address valid */ 113 + #define IFF_DEBUG 0x4 /* turn on debugging */ 114 + #define IFF_LOOPBACK 0x8 /* is a loopback net */ 115 + #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ 116 + #define IFF_NOTRAILERS 0x20 /* obsolete: avoid use of trailers */ 117 + #define IFF_RUNNING 0x40 /* resources allocated */ 118 + #define IFF_NOARP 0x80 /* no address resolution protocol */ 119 + #define IFF_PROMISC 0x100 /* receive all packets */ 120 + #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ 121 + #define IFF_OACTIVE 0x400 /* transmission in progress */ 122 + #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ 123 + #define IFF_LINK0 0x1000 /* per link layer defined bit */ 124 + #define IFF_LINK1 0x2000 /* per link layer defined bit */ 125 + #define IFF_LINK2 0x4000 /* per link layer defined bit */ 126 + #define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ 127 + #define IFF_MULTICAST 0x8000 /* supports multicast */ 128 + 129 + 130 + 131 + /* 132 + * Capabilities that interfaces can advertise. 133 + * 134 + * struct ifnet.if_capabilities 135 + * contains the optional features & capabilities a particular interface 136 + * supports (not only the driver but also the detected hw revision). 137 + * Capabilities are defined by IFCAP_* below. 138 + * struct ifnet.if_capenable 139 + * contains the enabled (either by default or through ifconfig) optional 140 + * features & capabilities on this interface. 141 + * Capabilities are defined by IFCAP_* below. 142 + * struct if_data.ifi_hwassist in IFNET_* form, defined in net/kpi_interface.h, 143 + * contains the enabled optional features & capabilites that can be used 144 + * individually per packet and are specified in the mbuf pkthdr.csum_flags 145 + * field. IFCAP_* and IFNET_* do not match one to one and IFNET_* may be 146 + * more detailed or differenciated than IFCAP_*. 147 + * IFNET_* hwassist flags have corresponding CSUM_* in sys/mbuf.h 148 + */ 149 + #define IFCAP_RXCSUM 0x00001 /* can offload checksum on RX */ 150 + #define IFCAP_TXCSUM 0x00002 /* can offload checksum on TX */ 151 + #define IFCAP_VLAN_MTU 0x00004 /* VLAN-compatible MTU */ 152 + #define IFCAP_VLAN_HWTAGGING 0x00008 /* hardware VLAN tag support */ 153 + #define IFCAP_JUMBO_MTU 0x00010 /* 9000 byte MTU supported */ 154 + #define IFCAP_TSO4 0x00020 /* can do TCP Segmentation Offload */ 155 + #define IFCAP_TSO6 0x00040 /* can do TCP6 Segmentation Offload */ 156 + #define IFCAP_LRO 0x00080 /* can do Large Receive Offload */ 157 + #define IFCAP_AV 0x00100 /* can do 802.1 AV Bridging */ 158 + 159 + #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) 160 + #define IFCAP_TSO (IFCAP_TSO4 | IFCAP_TSO6) 161 + 162 + #define IFCAP_VALID (IFCAP_HWCSUM | IFCAP_TSO | IFCAP_LRO | IFCAP_VLAN_MTU | \ 163 + IFCAP_VLAN_HWTAGGING | IFCAP_JUMBO_MTU | IFCAP_AV) 164 + 165 + #define IFQ_MAXLEN 128 166 + #define IFNET_SLOWHZ 1 /* granularity is 1 second */ 167 + 168 + /* 169 + * Message format for use in obtaining information about interfaces 170 + * from sysctl and the routing socket 171 + */ 172 + struct if_msghdr { 173 + unsigned short ifm_msglen; /* to skip over non-understood messages */ 174 + unsigned char ifm_version; /* future binary compatability */ 175 + unsigned char ifm_type; /* message type */ 176 + int ifm_addrs; /* like rtm_addrs */ 177 + int ifm_flags; /* value of if_flags */ 178 + unsigned short ifm_index; /* index for associated ifp */ 179 + struct if_data ifm_data; /* statistics and other data about if */ 180 + }; 181 + 182 + /* 183 + * Message format for use in obtaining information about interface addresses 184 + * from sysctl and the routing socket 185 + */ 186 + struct ifa_msghdr { 187 + unsigned short ifam_msglen; /* to skip over non-understood messages */ 188 + unsigned char ifam_version; /* future binary compatability */ 189 + unsigned char ifam_type; /* message type */ 190 + int ifam_addrs; /* like rtm_addrs */ 191 + int ifam_flags; /* value of ifa_flags */ 192 + unsigned short ifam_index; /* index for associated ifp */ 193 + int ifam_metric; /* value of ifa_metric */ 194 + }; 195 + 196 + /* 197 + * Message format for use in obtaining information about multicast addresses 198 + * from the routing socket 199 + */ 200 + struct ifma_msghdr { 201 + unsigned short ifmam_msglen; /* to skip over non-understood messages */ 202 + unsigned char ifmam_version; /* future binary compatability */ 203 + unsigned char ifmam_type; /* message type */ 204 + int ifmam_addrs; /* like rtm_addrs */ 205 + int ifmam_flags; /* value of ifa_flags */ 206 + unsigned short ifmam_index; /* index for associated ifp */ 207 + }; 208 + 209 + /* 210 + * Message format for use in obtaining information about interfaces 211 + * from sysctl 212 + */ 213 + struct if_msghdr2 { 214 + u_short ifm_msglen; /* to skip over non-understood messages */ 215 + u_char ifm_version; /* future binary compatability */ 216 + u_char ifm_type; /* message type */ 217 + int ifm_addrs; /* like rtm_addrs */ 218 + int ifm_flags; /* value of if_flags */ 219 + u_short ifm_index; /* index for associated ifp */ 220 + int ifm_snd_len; /* instantaneous length of send queue */ 221 + int ifm_snd_maxlen; /* maximum length of send queue */ 222 + int ifm_snd_drops; /* number of drops in send queue */ 223 + int ifm_timer; /* time until if_watchdog called */ 224 + struct if_data64 ifm_data; /* statistics and other data about if */ 225 + }; 226 + 227 + /* 228 + * Message format for use in obtaining information about multicast addresses 229 + * from sysctl 230 + */ 231 + struct ifma_msghdr2 { 232 + u_short ifmam_msglen; /* to skip over non-understood messages */ 233 + u_char ifmam_version; /* future binary compatability */ 234 + u_char ifmam_type; /* message type */ 235 + int ifmam_addrs; /* like rtm_addrs */ 236 + int ifmam_flags; /* value of ifa_flags */ 237 + u_short ifmam_index; /* index for associated ifp */ 238 + int32_t ifmam_refcount; 239 + }; 240 + 241 + /* 242 + * ifdevmtu: interface device mtu 243 + * Used with SIOCGIFDEVMTU to get the current mtu in use by the device, 244 + * as well as the minimum and maximum mtu allowed by the device. 245 + */ 246 + struct ifdevmtu { 247 + int ifdm_current; 248 + int ifdm_min; 249 + int ifdm_max; 250 + }; 251 + 252 + #pragma pack(4) 253 + 254 + /* 255 + ifkpi: interface kpi ioctl 256 + Used with SIOCSIFKPI and SIOCGIFKPI. 257 + 258 + ifk_module_id - From in the kernel, a value from kev_vendor_code_find. From 259 + user space, a value from SIOCGKEVVENDOR ioctl on a kernel event socket. 260 + ifk_type - The type. Types are specific to each module id. 261 + ifk_data - The data. ifk_ptr may be a 64bit pointer for 64 bit processes. 262 + 263 + Copying data between user space and kernel space is done using copyin 264 + and copyout. A process may be running in 64bit mode. In such a case, 265 + the pointer will be a 64bit pointer, not a 32bit pointer. The following 266 + sample is a safe way to copy the data in to the kernel from either a 267 + 32bit or 64bit process: 268 + 269 + user_addr_t tmp_ptr; 270 + if (IS_64BIT_PROCESS(current_proc())) { 271 + tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr64); 272 + } 273 + else { 274 + tmp_ptr = CAST_USER_ADDR_T(ifkpi.ifk_data.ifk_ptr); 275 + } 276 + error = copyin(tmp_ptr, allocated_dst_buffer, size of allocated_dst_buffer); 277 + */ 278 + 279 + struct ifkpi { 280 + unsigned int ifk_module_id; 281 + unsigned int ifk_type; 282 + union { 283 + void *ifk_ptr; 284 + int ifk_value; 285 + } ifk_data; 286 + }; 287 + 288 + /* Wake capabilities of a interface */ 289 + #define IF_WAKE_ON_MAGIC_PACKET 0x01 290 + 291 + 292 + #pragma pack() 293 + 294 + /* 295 + * Interface request structure used for socket 296 + * ioctl's. All interface ioctl's must have parameter 297 + * definitions which begin with ifr_name. The 298 + * remainder may be interface specific. 299 + */ 300 + struct ifreq { 301 + #ifndef IFNAMSIZ 302 + #define IFNAMSIZ IF_NAMESIZE 303 + #endif 304 + char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 305 + union { 306 + struct sockaddr ifru_addr; 307 + struct sockaddr ifru_dstaddr; 308 + struct sockaddr ifru_broadaddr; 309 + short ifru_flags; 310 + int ifru_metric; 311 + int ifru_mtu; 312 + int ifru_phys; 313 + int ifru_media; 314 + int ifru_intval; 315 + caddr_t ifru_data; 316 + struct ifdevmtu ifru_devmtu; 317 + struct ifkpi ifru_kpi; 318 + u_int32_t ifru_wake_flags; 319 + u_int32_t ifru_route_refcnt; 320 + int ifru_cap[2]; 321 + } ifr_ifru; 322 + #define ifr_addr ifr_ifru.ifru_addr /* address */ 323 + #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ 324 + #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 325 + #ifdef __APPLE__ 326 + #define ifr_flags ifr_ifru.ifru_flags /* flags */ 327 + #else 328 + #define ifr_flags ifr_ifru.ifru_flags[0] /* flags */ 329 + #define ifr_prevflags ifr_ifru.ifru_flags[1] /* flags */ 330 + #endif /* __APPLE__ */ 331 + #define ifr_metric ifr_ifru.ifru_metric /* metric */ 332 + #define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ 333 + #define ifr_phys ifr_ifru.ifru_phys /* physical wire */ 334 + #define ifr_media ifr_ifru.ifru_media /* physical media */ 335 + #define ifr_data ifr_ifru.ifru_data /* for use by interface */ 336 + #define ifr_devmtu ifr_ifru.ifru_devmtu 337 + #define ifr_intval ifr_ifru.ifru_intval /* integer value */ 338 + #define ifr_kpi ifr_ifru.ifru_kpi 339 + #define ifr_wake_flags ifr_ifru.ifru_wake_flags /* wake capabilities of devive */ 340 + #define ifr_route_refcnt ifr_ifru.ifru_route_refcnt /* route references on interface */ 341 + #define ifr_reqcap ifr_ifru.ifru_cap[0] /* requested capabilities */ 342 + #define ifr_curcap ifr_ifru.ifru_cap[1] /* current capabilities */ 343 + }; 344 + 345 + #define _SIZEOF_ADDR_IFREQ(ifr) \ 346 + ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \ 347 + (sizeof(struct ifreq) - sizeof(struct sockaddr) + \ 348 + (ifr).ifr_addr.sa_len) : sizeof(struct ifreq)) 349 + 350 + struct ifaliasreq { 351 + char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 352 + struct sockaddr ifra_addr; 353 + struct sockaddr ifra_broadaddr; 354 + struct sockaddr ifra_mask; 355 + }; 356 + 357 + struct rslvmulti_req { 358 + struct sockaddr *sa; 359 + struct sockaddr **llsa; 360 + }; 361 + 362 + #pragma pack(4) 363 + 364 + struct ifmediareq { 365 + char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 366 + int ifm_current; /* current media options */ 367 + int ifm_mask; /* don't care mask */ 368 + int ifm_status; /* media status */ 369 + int ifm_active; /* active options */ 370 + int ifm_count; /* # entries in ifm_ulist array */ 371 + int *ifm_ulist; /* media words */ 372 + }; 373 + 374 + #pragma pack() 375 + 376 + 377 + 378 + #pragma pack(4) 379 + struct ifdrv { 380 + char ifd_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 381 + unsigned long ifd_cmd; 382 + size_t ifd_len; 383 + void *ifd_data; 384 + }; 385 + #pragma pack() 386 + 387 + 388 + /* 389 + * Structure used to retrieve aux status data from interfaces. 390 + * Kernel suppliers to this interface should respect the formatting 391 + * needed by ifconfig(8): each line starts with a TAB and ends with 392 + * a newline. The canonical example to copy and paste is in if_tun.c. 393 + */ 394 + 395 + #define IFSTATMAX 800 /* 10 lines of text */ 396 + struct ifstat { 397 + char ifs_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 398 + char ascii[IFSTATMAX + 1]; 399 + }; 400 + 401 + /* 402 + * Structure used in SIOCGIFCONF request. 403 + * Used to retrieve interface configuration 404 + * for machine (useful for programs which 405 + * must know all networks accessible). 406 + */ 407 + #pragma pack(4) 408 + struct ifconf { 409 + int ifc_len; /* size of associated buffer */ 410 + union { 411 + caddr_t ifcu_buf; 412 + struct ifreq *ifcu_req; 413 + } ifc_ifcu; 414 + }; 415 + #pragma pack() 416 + #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 417 + #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ 418 + 419 + 420 + /* 421 + * DLIL KEV_DL_PROTO_ATTACHED/DETACHED structure 422 + */ 423 + struct kev_dl_proto_data { 424 + struct net_event_data link_data; 425 + u_int32_t proto_family; 426 + u_int32_t proto_remaining_count; 427 + }; 428 + 429 + /* 430 + * Structure for SIOC[AGD]LIFADDR 431 + */ 432 + struct if_laddrreq { 433 + char iflr_name[IFNAMSIZ]; 434 + unsigned int flags; 435 + #define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ 436 + unsigned int prefixlen; /* in/out */ 437 + struct sockaddr_storage addr; /* in/out */ 438 + struct sockaddr_storage dstaddr; /* out */ 439 + }; 440 + 441 + 442 + #endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */ 443 + 444 + struct if_nameindex { 445 + unsigned int if_index; /* 1, 2, ... */ 446 + char *if_name; /* null terminated name: "le0", ... */ 447 + }; 448 + 449 + __BEGIN_DECLS 450 + unsigned int if_nametoindex(const char *); 451 + char *if_indextoname(unsigned int, char *); 452 + struct if_nameindex *if_nameindex(void); 453 + void if_freenameindex(struct if_nameindex *); 454 + __END_DECLS 455 + 456 + 457 + #endif /* !_NET_IF_H_ */
+123
platform-include/net/if_arp.h
··· 1 + /* 2 + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1986, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 61 + * $FreeBSD: src/sys/net/if_arp.h,v 1.14.2.1 2000/07/11 20:46:55 archie Exp $ 62 + */ 63 + 64 + #ifndef _NET_IF_ARP_H_ 65 + #define _NET_IF_ARP_H_ 66 + #include <sys/appleapiopts.h> 67 + #include <netinet/in.h> 68 + 69 + /* 70 + * Address Resolution Protocol. 71 + * 72 + * See RFC 826 for protocol description. ARP packets are variable 73 + * in size; the arphdr structure defines the fixed-length portion. 74 + * Protocol type values are the same as those for 10 Mb/s Ethernet. 75 + * It is followed by the variable-sized fields ar_sha, arp_spa, 76 + * arp_tha and arp_tpa in that order, according to the lengths 77 + * specified. Field names used correspond to RFC 826. 78 + */ 79 + struct arphdr { 80 + u_short ar_hrd; /* format of hardware address */ 81 + #define ARPHRD_ETHER 1 /* ethernet hardware format */ 82 + #define ARPHRD_IEEE802 6 /* token-ring hardware format */ 83 + #define ARPHRD_FRELAY 15 /* frame relay hardware format */ 84 + #define ARPHRD_IEEE1394 24 /* IEEE1394 hardware address */ 85 + #define ARPHRD_IEEE1394_EUI64 27 /* IEEE1394 EUI-64 */ 86 + u_short ar_pro; /* format of protocol address */ 87 + u_char ar_hln; /* length of hardware address */ 88 + u_char ar_pln; /* length of protocol address */ 89 + u_short ar_op; /* one of: */ 90 + #define ARPOP_REQUEST 1 /* request to resolve address */ 91 + #define ARPOP_REPLY 2 /* response to previous request */ 92 + #define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ 93 + #define ARPOP_REVREPLY 4 /* response giving protocol address */ 94 + #define ARPOP_INVREQUEST 8 /* request to identify peer */ 95 + #define ARPOP_INVREPLY 9 /* response identifying peer */ 96 + /* 97 + * The remaining fields are variable in size, 98 + * according to the sizes above. 99 + */ 100 + #ifdef COMMENT_ONLY 101 + u_char ar_sha[]; /* sender hardware address */ 102 + u_char ar_spa[]; /* sender protocol address */ 103 + u_char ar_tha[]; /* target hardware address */ 104 + u_char ar_tpa[]; /* target protocol address */ 105 + #endif 106 + }; 107 + 108 + /* 109 + * ARP ioctl request 110 + */ 111 + struct arpreq { 112 + struct sockaddr arp_pa; /* protocol address */ 113 + struct sockaddr arp_ha; /* hardware address */ 114 + int arp_flags; /* flags */ 115 + }; 116 + /* arp_flags and at_flags field values */ 117 + #define ATF_INUSE 0x01 /* entry in use */ 118 + #define ATF_COM 0x02 /* completed entry (enaddr valid) */ 119 + #define ATF_PERM 0x04 /* permanent entry */ 120 + #define ATF_PUBL 0x08 /* publish entry (respond for other host) */ 121 + #define ATF_USETRAILERS 0x10 /* has requested trailers */ 122 + 123 + #endif /* !_NET_IF_ARP_H_ */
+118
platform-include/net/if_dl.h
··· 1 + /* 2 + * Copyright (c) 2000-2011 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1990, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * @(#)if_dl.h 8.1 (Berkeley) 6/10/93 61 + * $FreeBSD: src/sys/net/if_dl.h,v 1.10 2000/03/01 02:46:25 archie Exp $ 62 + */ 63 + 64 + #ifndef _NET_IF_DL_H_ 65 + #define _NET_IF_DL_H_ 66 + #include <sys/appleapiopts.h> 67 + 68 + /* 69 + * A Link-Level Sockaddr may specify the interface in one of two 70 + * ways: either by means of a system-provided index number (computed 71 + * anew and possibly differently on every reboot), or by a human-readable 72 + * string such as "il0" (for managerial convenience). 73 + * 74 + * Census taking actions, such as something akin to SIOCGCONF would return 75 + * both the index and the human name. 76 + * 77 + * High volume transactions (such as giving a link-level ``from'' address 78 + * in a recvfrom or recvmsg call) may be likely only to provide the indexed 79 + * form, (which requires fewer copy operations and less space). 80 + * 81 + * The form and interpretation of the link-level address is purely a matter 82 + * of convention between the device driver and its consumers; however, it is 83 + * expected that all drivers for an interface of a given if_type will agree. 84 + */ 85 + 86 + /* 87 + * Structure of a Link-Level sockaddr: 88 + */ 89 + struct sockaddr_dl { 90 + u_char sdl_len; /* Total length of sockaddr */ 91 + u_char sdl_family; /* AF_LINK */ 92 + u_short sdl_index; /* if != 0, system given index for interface */ 93 + u_char sdl_type; /* interface type */ 94 + u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */ 95 + u_char sdl_alen; /* link level address length */ 96 + u_char sdl_slen; /* link layer selector length */ 97 + char sdl_data[12]; /* minimum work area, can be larger; 98 + contains both if name and ll address */ 99 + #ifndef __APPLE__ 100 + /* For TokenRing */ 101 + u_short sdl_rcf; /* source routing control */ 102 + u_short sdl_route[16]; /* source routing information */ 103 + #endif 104 + }; 105 + 106 + #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) 107 + 108 + 109 + 110 + #include <sys/cdefs.h> 111 + 112 + __BEGIN_DECLS 113 + void link_addr(const char *, struct sockaddr_dl *); 114 + char *link_ntoa(const struct sockaddr_dl *); 115 + __END_DECLS 116 + 117 + 118 + #endif
+195
platform-include/net/if_llc.h
··· 1 + /* 2 + * Copyright (c) 2000,2009 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1988, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. Neither the name of the University nor the names of its contributors 41 + * may be used to endorse or promote products derived from this software 42 + * without specific prior written permission. 43 + * 44 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 45 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 48 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 50 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 + * SUCH DAMAGE. 55 + * 56 + * @(#)if_llc.h 8.1 (Berkeley) 6/10/93 57 + */ 58 + 59 + #ifndef _NET_IF_LLC_H_ 60 + #define _NET_IF_LLC_H_ 61 + #include <sys/appleapiopts.h> 62 + 63 + /* 64 + * IEEE 802.2 Link Level Control headers, for use in conjunction with 65 + * 802.{3,4,5} media access control methods. 66 + * 67 + * Headers here do not use bit fields due to shortcomings in many 68 + * compilers. 69 + */ 70 + 71 + struct llc { 72 + u_int8_t llc_dsap; 73 + u_int8_t llc_ssap; 74 + union { 75 + struct { 76 + u_int8_t control; 77 + u_int8_t format_id; 78 + u_int8_t class_id; 79 + u_int8_t window_x2; 80 + } type_u; 81 + struct { 82 + u_int8_t num_snd_x2; 83 + u_int8_t num_rcv_x2; 84 + } type_i; 85 + struct { 86 + u_int8_t control; 87 + u_int8_t num_rcv_x2; 88 + } type_s; 89 + struct { 90 + u_int8_t control; 91 + /* 92 + * We cannot put the following fields in a structure because 93 + * the structure rounding might cause padding. 94 + */ 95 + u_int8_t frmr_rej_pdu0; 96 + u_int8_t frmr_rej_pdu1; 97 + u_int8_t frmr_control; 98 + u_int8_t frmr_control_ext; 99 + u_int8_t frmr_cause; 100 + } type_frmr; 101 + struct { 102 + u_int8_t control; 103 + u_int8_t org_code[3]; 104 + u_int16_t ether_type; 105 + } type_snap __attribute__((__packed__)); 106 + struct { 107 + u_int8_t control; 108 + u_int8_t control_ext; 109 + } type_raw; 110 + } llc_un; 111 + } __attribute__((__packed__)); 112 + 113 + struct frmrinfo { 114 + u_int8_t frmr_rej_pdu0; 115 + u_int8_t frmr_rej_pdu1; 116 + u_int8_t frmr_control; 117 + u_int8_t frmr_control_ext; 118 + u_int8_t frmr_cause; 119 + } __attribute__((__packed__)); 120 + 121 + #define llc_control llc_un.type_u.control 122 + #define llc_control_ext llc_un.type_raw.control_ext 123 + #define llc_fid llc_un.type_u.format_id 124 + #define llc_class llc_un.type_u.class 125 + #define llc_window llc_un.type_u.window_x2 126 + #define llc_frmrinfo llc_un.type_frmr.frmr_rej_pdu0 127 + #define llc_frmr_pdu0 llc_un.type_frmr.frmr_rej_pdu0 128 + #define llc_frmr_pdu1 llc_un.type_frmr.frmr_rej_pdu1 129 + #define llc_frmr_control llc_un.type_frmr.frmr_control 130 + #define llc_frmr_control_ext llc_un.type_frmr.frmr_control_ext 131 + #define llc_frmr_cause llc_un.type_frmr.frmr_cause 132 + #define llc_snap llc_un.type_snap 133 + 134 + /* 135 + * Don't use sizeof(struct llc_un) for LLC header sizes 136 + */ 137 + #define LLC_ISFRAMELEN 4 138 + #define LLC_UFRAMELEN 3 139 + #define LLC_FRMRLEN 7 140 + #define LLC_SNAPFRAMELEN 8 141 + 142 + /* 143 + * Unnumbered LLC format commands 144 + */ 145 + #define LLC_UI 0x3 146 + #define LLC_UI_P 0x13 147 + #define LLC_DISC 0x43 148 + #define LLC_DISC_P 0x53 149 + #define LLC_UA 0x63 150 + #define LLC_UA_P 0x73 151 + #define LLC_TEST 0xe3 152 + #define LLC_TEST_P 0xf3 153 + #define LLC_FRMR 0x87 154 + #define LLC_FRMR_P 0x97 155 + #define LLC_DM 0x0f 156 + #define LLC_DM_P 0x1f 157 + #define LLC_XID 0xaf 158 + #define LLC_XID_P 0xbf 159 + #define LLC_SABME 0x6f 160 + #define LLC_SABME_P 0x7f 161 + 162 + /* 163 + * Supervisory LLC commands 164 + */ 165 + #define LLC_RR 0x01 166 + #define LLC_RNR 0x05 167 + #define LLC_REJ 0x09 168 + 169 + /* 170 + * Info format - dummy only 171 + */ 172 + #define LLC_INFO 0x00 173 + 174 + /* 175 + * ISO PDTR 10178 contains among others 176 + */ 177 + #define LLC_8021D_LSAP 0x42 178 + #define LLC_X25_LSAP 0x7e 179 + #define LLC_SNAP_LSAP 0xaa 180 + #define LLC_ISO_LSAP 0xfe 181 + 182 + /* 183 + * LLC XID definitions from 802.2, as needed 184 + */ 185 + 186 + #define LLC_XID_FORMAT_BASIC 0x81 187 + #define LLC_XID_BASIC_MINLEN (LLC_UFRAMELEN + 3) 188 + 189 + #define LLC_XID_CLASS_I 0x1 190 + #define LLC_XID_CLASS_II 0x3 191 + #define LLC_XID_CLASS_III 0x5 192 + #define LLC_XID_CLASS_IV 0x7 193 + 194 + 195 + #endif /* !_NET_IF_LLC_H_ */
+366
platform-include/net/if_media.h
··· 1 + /* 2 + * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ 29 + /* $FreeBSD: src/sys/net/if_media.h,v 1.9.2.1 2001/07/04 00:12:38 brooks Exp $ */ 30 + 31 + /* 32 + * Copyright (c) 1997 33 + * Jonathan Stone and Jason R. Thorpe. All rights reserved. 34 + * 35 + * This software is derived from information provided by Matt Thomas. 36 + * 37 + * Redistribution and use in source and binary forms, with or without 38 + * modification, are permitted provided that the following conditions 39 + * are met: 40 + * 1. Redistributions of source code must retain the above copyright 41 + * notice, this list of conditions and the following disclaimer. 42 + * 2. Redistributions in binary form must reproduce the above copyright 43 + * notice, this list of conditions and the following disclaimer in the 44 + * documentation and/or other materials provided with the distribution. 45 + * 3. All advertising materials mentioning features or use of this software 46 + * must display the following acknowledgement: 47 + * This product includes software developed by Jonathan Stone 48 + * and Jason R. Thorpe for the NetBSD Project. 49 + * 4. The names of the authors may not be used to endorse or promote products 50 + * derived from this software without specific prior written permission. 51 + * 52 + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 53 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 54 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 55 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 56 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 57 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 58 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 59 + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 60 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 61 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 62 + * SUCH DAMAGE. 63 + */ 64 + 65 + #ifndef _NET_IF_MEDIA_H_ 66 + #define _NET_IF_MEDIA_H_ 67 + #include <sys/appleapiopts.h> 68 + 69 + /* 70 + * Prototypes and definitions for BSD/OS-compatible network interface 71 + * media selection. 72 + * 73 + * Where it is safe to do so, this code strays slightly from the BSD/OS 74 + * design. Software which uses the API (device drivers, basically) 75 + * shouldn't notice any difference. 76 + * 77 + * Many thanks to Matt Thomas for providing the information necessary 78 + * to implement this interface. 79 + */ 80 + 81 + 82 + /* 83 + * if_media Options word: 84 + * Bits Use 85 + * ---- ------- 86 + * 0-4 Media subtype 87 + * 5-7 Media type 88 + * 8-15 Type specific options 89 + * 16-19 RFU 90 + * 20-27 Shared (global) options 91 + * 28-31 Instance 92 + */ 93 + 94 + /* 95 + * Ethernet 96 + */ 97 + #define IFM_ETHER 0x00000020 98 + #define IFM_10_T 3 /* 10BaseT - RJ45 */ 99 + #define IFM_10_2 4 /* 10Base2 - Thinnet */ 100 + #define IFM_10_5 5 /* 10Base5 - AUI */ 101 + #define IFM_100_TX 6 /* 100BaseTX - RJ45 */ 102 + #define IFM_100_FX 7 /* 100BaseFX - Fiber */ 103 + #define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ 104 + #define IFM_100_VG 9 /* 100VG-AnyLAN */ 105 + #define IFM_100_T2 10 /* 100BaseT2 */ 106 + #define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ 107 + #define IFM_10_STP 12 /* 10BaseT over shielded TP */ 108 + #define IFM_10_FL 13 /* 10baseFL - Fiber */ 109 + #define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ 110 + #define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ 111 + #define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ 112 + #define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ 113 + #define IFM_10G_SR 18 /* 10GbaseSR - multi-mode fiber */ 114 + #define IFM_10G_LR 19 /* 10GbaseLR - single-mode fiber */ 115 + #define IFM_10G_CX4 20 /* 10GbaseCX4 - copper */ 116 + #define IFM_10G_T 21 /* 10GbaseT - 4 pair cat 6 */ 117 + 118 + /* 119 + * Token ring 120 + */ 121 + #define IFM_TOKEN 0x00000040 122 + #define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ 123 + #define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ 124 + #define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ 125 + #define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ 126 + #define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ 127 + #define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ 128 + #define IFM_TOK_ETR 0x00000200 /* Early token release */ 129 + #define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ 130 + #define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ 131 + #define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ 132 + #define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ 133 + #define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ 134 + 135 + /* 136 + * FDDI 137 + */ 138 + #define IFM_FDDI 0x00000060 139 + #define IFM_FDDI_SMF 3 /* Single-mode fiber */ 140 + #define IFM_FDDI_MMF 4 /* Multi-mode fiber */ 141 + #define IFM_FDDI_UTP 5 /* CDDI / UTP */ 142 + #define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ 143 + 144 + /* 145 + * IEEE 802.11 Wireless 146 + */ 147 + #define IFM_IEEE80211 0x00000080 148 + #define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ 149 + #define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ 150 + #define IFM_IEEE80211_DS2 5 /* Direct Sequence 2Mbps */ 151 + #define IFM_IEEE80211_DS5 6 /* Direct Sequence 5Mbps*/ 152 + #define IFM_IEEE80211_DS11 7 /* Direct Sequence 11Mbps*/ 153 + #define IFM_IEEE80211_DS1 8 /* Direct Sequence 1Mbps */ 154 + #define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ 155 + #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ 156 + 157 + /* 158 + * Shared media sub-types 159 + */ 160 + #define IFM_AUTO 0 /* Autoselect best media */ 161 + #define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ 162 + #define IFM_NONE 2 /* Deselect all media */ 163 + 164 + /* 165 + * Shared options 166 + */ 167 + #define IFM_FDX 0x00100000 /* Force full duplex */ 168 + #define IFM_HDX 0x00200000 /* Force half duplex */ 169 + #define IFM_FLOW 0x00400000 /* enable hardware flow control */ 170 + #define IFM_EEE 0x00800000 /* Support energy efficient ethernet */ 171 + #define IFM_FLAG0 0x01000000 /* Driver defined flag */ 172 + #define IFM_FLAG1 0x02000000 /* Driver defined flag */ 173 + #define IFM_FLAG2 0x04000000 /* Driver defined flag */ 174 + #define IFM_LOOP 0x08000000 /* Put hardware in loopback */ 175 + 176 + /* 177 + * Masks 178 + */ 179 + #define IFM_NMASK 0x000000e0 /* Network type */ 180 + #define IFM_TMASK 0x0000001f /* Media sub-type */ 181 + #define IFM_IMASK 0xf0000000 /* Instance */ 182 + #define IFM_ISHIFT 28 /* Instance shift */ 183 + #define IFM_OMASK 0x0000ff00 /* Type specific options */ 184 + #define IFM_GMASK 0x0ff00000 /* Global options */ 185 + 186 + /* 187 + * Status bits 188 + */ 189 + #define IFM_AVALID 0x00000001 /* Active bit valid */ 190 + #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ 191 + 192 + /* 193 + * Macros to extract various bits of information from the media word. 194 + */ 195 + #define IFM_TYPE(x) ((x) & IFM_NMASK) 196 + #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) 197 + #define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) 198 + #define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) 199 + #define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) 200 + 201 + #define IFM_INST_MAX IFM_INST(IFM_IMASK) 202 + 203 + /* 204 + * Macro to create a media word. 205 + */ 206 + #define IFM_MAKEWORD(type, subtype, options, instance) \ 207 + ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) 208 + 209 + /* 210 + * NetBSD extension not defined in the BSDI API. This is used in various 211 + * places to get the canonical description for a given type/subtype. 212 + * 213 + * NOTE: all but the top-level type descriptions must contain NO whitespace! 214 + * Otherwise, parsing these in ifconfig(8) would be a nightmare. 215 + */ 216 + struct ifmedia_description { 217 + int ifmt_word; /* word value; may be masked */ 218 + const char *ifmt_string; /* description */ 219 + }; 220 + 221 + #define IFM_TYPE_DESCRIPTIONS { \ 222 + { IFM_ETHER, "Ethernet" }, \ 223 + { IFM_TOKEN, "Token ring" }, \ 224 + { IFM_FDDI, "FDDI" }, \ 225 + { IFM_IEEE80211, "IEEE802.11" }, \ 226 + { 0, NULL }, \ 227 + } 228 + 229 + #define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ 230 + { IFM_10_T, "10baseT/UTP" }, \ 231 + { IFM_10_2, "10base2/BNC" }, \ 232 + { IFM_10_5, "10base5/AUI" }, \ 233 + { IFM_100_TX, "100baseTX" }, \ 234 + { IFM_100_FX, "100baseFX" }, \ 235 + { IFM_100_T4, "100baseT4" }, \ 236 + { IFM_100_VG, "100baseVG" }, \ 237 + { IFM_100_T2, "100baseT2" }, \ 238 + { IFM_1000_SX, "1000baseSX" }, \ 239 + { IFM_10_STP, "10baseSTP" }, \ 240 + { IFM_10_FL, "10baseFL" }, \ 241 + { IFM_1000_LX, "1000baseLX" }, \ 242 + { IFM_1000_CX, "1000baseCX" }, \ 243 + { IFM_1000_T, "1000baseT" }, \ 244 + { IFM_HPNA_1, "HomePNA1" }, \ 245 + { IFM_10G_SR, "10GbaseSR" }, \ 246 + { IFM_10G_LR, "10GbaseLR" }, \ 247 + { IFM_10G_CX4, "10GbaseCX4" }, \ 248 + { IFM_10G_T, "10GbaseT" }, \ 249 + { 0, NULL }, \ 250 + } 251 + 252 + #define IFM_SUBTYPE_ETHERNET_ALIASES { \ 253 + { IFM_10_T, "UTP" }, \ 254 + { IFM_10_T, "10UTP" }, \ 255 + { IFM_10_2, "BNC" }, \ 256 + { IFM_10_2, "10BNC" }, \ 257 + { IFM_10_5, "AUI" }, \ 258 + { IFM_10_5, "10AUI" }, \ 259 + { IFM_100_TX, "100TX" }, \ 260 + { IFM_100_FX, "100FX" }, \ 261 + { IFM_100_T4, "100T4" }, \ 262 + { IFM_100_VG, "100VG" }, \ 263 + { IFM_100_T2, "100T2" }, \ 264 + { IFM_1000_SX, "1000SX" }, \ 265 + { IFM_10_STP, "STP" }, \ 266 + { IFM_10_STP, "10STP" }, \ 267 + { IFM_10_FL, "FL" }, \ 268 + { IFM_10_FL, "10FL" }, \ 269 + { IFM_1000_LX, "1000LX" }, \ 270 + { IFM_1000_CX, "1000CX" }, \ 271 + { IFM_1000_T, "1000T" }, \ 272 + { IFM_HPNA_1, "HPNA1" }, \ 273 + { IFM_10G_SR, "10GSR" }, \ 274 + { IFM_10G_LR, "10GLR" }, \ 275 + { IFM_10G_CX4, "10GCX4" }, \ 276 + { IFM_10G_T, "10GT" }, \ 277 + { 0, NULL }, \ 278 + } 279 + 280 + #define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ 281 + { 0, NULL }, \ 282 + } 283 + 284 + #define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ 285 + { IFM_TOK_STP4, "DB9/4Mbit" }, \ 286 + { IFM_TOK_STP16, "DB9/16Mbit" }, \ 287 + { IFM_TOK_UTP4, "UTP/4Mbit" }, \ 288 + { IFM_TOK_UTP16, "UTP/16Mbit" }, \ 289 + { 0, NULL }, \ 290 + } 291 + 292 + #define IFM_SUBTYPE_TOKENRING_ALIASES { \ 293 + { IFM_TOK_STP4, "4STP" }, \ 294 + { IFM_TOK_STP16, "16STP" }, \ 295 + { IFM_TOK_UTP4, "4UTP" }, \ 296 + { IFM_TOK_UTP16, "16UTP" }, \ 297 + { 0, NULL }, \ 298 + } 299 + 300 + #define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ 301 + { IFM_TOK_ETR, "EarlyTokenRelease" }, \ 302 + { IFM_TOK_SRCRT, "SourceRouting" }, \ 303 + { IFM_TOK_ALLR, "AllRoutes" }, \ 304 + { 0, NULL }, \ 305 + } 306 + 307 + #define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ 308 + { IFM_FDDI_SMF, "Single-mode" }, \ 309 + { IFM_FDDI_MMF, "Multi-mode" }, \ 310 + { IFM_FDDI_UTP, "UTP" }, \ 311 + { 0, NULL }, \ 312 + } 313 + 314 + #define IFM_SUBTYPE_FDDI_ALIASES { \ 315 + { IFM_FDDI_SMF, "SMF" }, \ 316 + { IFM_FDDI_MMF, "MMF" }, \ 317 + { IFM_FDDI_UTP, "CDDI" }, \ 318 + { 0, NULL }, \ 319 + } 320 + 321 + #define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ 322 + { IFM_FDDI_DA, "Dual-attach" }, \ 323 + { 0, NULL }, \ 324 + } 325 + 326 + #define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ 327 + { IFM_IEEE80211_FH1, "FH1" }, \ 328 + { IFM_IEEE80211_FH2, "FH2" }, \ 329 + { IFM_IEEE80211_DS1, "DS1" }, \ 330 + { IFM_IEEE80211_DS2, "DS2" }, \ 331 + { IFM_IEEE80211_DS5, "DS5" }, \ 332 + { IFM_IEEE80211_DS11, "DS11" }, \ 333 + { IFM_IEEE80211_DS22, "DS22" }, \ 334 + { 0, NULL }, \ 335 + } 336 + 337 + #define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ 338 + { IFM_IEEE80211_ADHOC, "adhoc" }, \ 339 + { 0, NULL }, \ 340 + } 341 + 342 + #define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ 343 + { IFM_AUTO, "autoselect" }, \ 344 + { IFM_MANUAL, "manual" }, \ 345 + { IFM_NONE, "none" }, \ 346 + { 0, NULL }, \ 347 + } 348 + 349 + #define IFM_SUBTYPE_SHARED_ALIASES { \ 350 + { IFM_AUTO, "auto" }, \ 351 + { 0, NULL }, \ 352 + } 353 + 354 + #define IFM_SHARED_OPTION_DESCRIPTIONS { \ 355 + { IFM_FDX, "full-duplex" }, \ 356 + { IFM_HDX, "half-duplex" }, \ 357 + { IFM_FLOW, "flow-control" }, \ 358 + { IFM_EEE, "energy-efficient-ethernet" }, \ 359 + { IFM_FLAG0, "flag0" }, \ 360 + { IFM_FLAG1, "flag1" }, \ 361 + { IFM_FLAG2, "flag2" }, \ 362 + { IFM_LOOP, "hw-loopback" }, \ 363 + { 0, NULL }, \ 364 + } 365 + 366 + #endif /* _NET_IF_MEDIA_H_ */
+214
platform-include/net/if_mib.h
··· 1 + /* 2 + * Copyright (c) 2000-2011 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright 1996 Massachusetts Institute of Technology 30 + * 31 + * Permission to use, copy, modify, and distribute this software and 32 + * its documentation for any purpose and without fee is hereby 33 + * granted, provided that both the above copyright notice and this 34 + * permission notice appear in all copies, that both the above 35 + * copyright notice and this permission notice appear in all 36 + * supporting documentation, and that the name of M.I.T. not be used 37 + * in advertising or publicity pertaining to distribution of the 38 + * software without specific, written prior permission. M.I.T. makes 39 + * no representations about the suitability of this software for any 40 + * purpose. It is provided "as is" without express or implied 41 + * warranty. 42 + * 43 + * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS 44 + * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, 45 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 46 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT 47 + * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 50 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 51 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 52 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 53 + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 + * SUCH DAMAGE. 55 + * 56 + * $FreeBSD: src/sys/net/if_mib.h,v 1.6 1999/08/28 00:48:19 peter Exp $ 57 + */ 58 + 59 + #ifndef _NET_IF_MIB_H 60 + #define _NET_IF_MIB_H 1 61 + #include <sys/appleapiopts.h> 62 + 63 + struct ifmibdata { 64 + char ifmd_name[IFNAMSIZ]; /* name of interface */ 65 + unsigned int ifmd_pcount; /* number of promiscuous listeners */ 66 + unsigned int ifmd_flags; /* interface flags */ 67 + unsigned int ifmd_snd_len; /* instantaneous length of send queue */ 68 + unsigned int ifmd_snd_maxlen; /* maximum length of send queue */ 69 + unsigned int ifmd_snd_drops; /* number of drops in send queue */ 70 + unsigned int ifmd_filler[4]; /* for future expansion */ 71 + struct if_data64 ifmd_data; /* generic information and statistics */ 72 + }; 73 + 74 + 75 + /* 76 + * sysctl MIB tags at the net.link.generic level 77 + */ 78 + #define IFMIB_SYSTEM 1 /* non-interface-specific */ 79 + #define IFMIB_IFDATA 2 /* per-interface data table */ 80 + #define IFMIB_IFALLDATA 3 /* all interfaces data at once */ 81 + 82 + /* 83 + * MIB tags for the various net.link.generic.ifdata tables 84 + */ 85 + #define IFDATA_GENERAL 1 /* generic stats for all kinds of ifaces */ 86 + #define IFDATA_LINKSPECIFIC 2 /* specific to the type of interface */ 87 + #define IFDATA_ADDRS 3 /* addresses assigned to interface */ 88 + #define IFDATA_MULTIADDRS 4 /* multicast addresses assigned to interface */ 89 + 90 + /* 91 + * MIB tags at the net.link.generic.system level 92 + */ 93 + #define IFMIB_IFCOUNT 1 /* number of interfaces configured */ 94 + 95 + /* 96 + * MIB tags as the net.link level 97 + * All of the other values are IFT_* names defined in if_types.h. 98 + */ 99 + #define NETLINK_GENERIC 0 /* functions not specific to a type of iface */ 100 + 101 + /* 102 + * The reason why the IFDATA_LINKSPECIFIC stuff is not under the 103 + * net.link.<iftype> branches is twofold: 104 + * 1) It's easier to code this way, and doesn't require duplication. 105 + * 2) The fourth level under net.link.<iftype> is <pf>; that is to say, 106 + * the net.link.<iftype> tree instruments the adaptation layers between 107 + * <iftype> and a particular protocol family (e.g., net.link.ether.inet 108 + * instruments ARP). This does not really leave room for anything else 109 + * that needs to have a well-known number. 110 + */ 111 + 112 + /* 113 + * Link-specific MIB structures for various link types. 114 + */ 115 + 116 + /* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */ 117 + struct ifs_iso_8802_3 { 118 + u_int32_t dot3StatsAlignmentErrors; 119 + u_int32_t dot3StatsFCSErrors; 120 + u_int32_t dot3StatsSingleCollisionFrames; 121 + u_int32_t dot3StatsMultipleCollisionFrames; 122 + u_int32_t dot3StatsSQETestErrors; 123 + u_int32_t dot3StatsDeferredTransmissions; 124 + u_int32_t dot3StatsLateCollisions; 125 + u_int32_t dot3StatsExcessiveCollisions; 126 + u_int32_t dot3StatsInternalMacTransmitErrors; 127 + u_int32_t dot3StatsCarrierSenseErrors; 128 + u_int32_t dot3StatsFrameTooLongs; 129 + u_int32_t dot3StatsInternalMacReceiveErrors; 130 + u_int32_t dot3StatsEtherChipSet; 131 + /* Matt Thomas wants this one, not included in RFC 1650: */ 132 + u_int32_t dot3StatsMissedFrames; 133 + 134 + u_int32_t dot3StatsCollFrequencies[16]; /* NB: index origin */ 135 + 136 + u_int32_t dot3Compliance; 137 + #define DOT3COMPLIANCE_STATS 1 138 + #define DOT3COMPLIANCE_COLLS 2 139 + }; 140 + 141 + /* 142 + * Chipset identifiers are normally part of the vendor's enterprise MIB. 143 + * However, we don't want to be trying to represent arbitrary-length 144 + * OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily 145 + * obvious to the driver implementor. So, we define our own identification 146 + * mechanism here, and let the agent writer deal with the translation. 147 + */ 148 + #define DOT3CHIPSET_VENDOR(x) ((x) >> 16) 149 + #define DOT3CHIPSET_PART(x) ((x) & 0xffff) 150 + #define DOT3CHIPSET(v,p) (((v) << 16) + ((p) & 0xffff)) 151 + 152 + /* Driver writers! Add your vendors here! */ 153 + enum dot3Vendors { 154 + dot3VendorAMD = 1, 155 + dot3VendorIntel = 2, 156 + dot3VendorNational = 4, 157 + dot3VendorFujitsu = 5, 158 + dot3VendorDigital = 6, 159 + dot3VendorWesternDigital = 7 160 + }; 161 + 162 + /* Driver writers! Add your chipsets here! */ 163 + enum { 164 + dot3ChipSetAMD7990 = 1, 165 + dot3ChipSetAMD79900 = 2, 166 + dot3ChipSetAMD79C940 = 3 167 + }; 168 + 169 + enum { 170 + dot3ChipSetIntel82586 = 1, 171 + dot3ChipSetIntel82596 = 2, 172 + dot3ChipSetIntel82557 = 3 173 + }; 174 + 175 + enum { 176 + dot3ChipSetNational8390 = 1, 177 + dot3ChipSetNationalSonic = 2 178 + }; 179 + 180 + enum { 181 + dot3ChipSetFujitsu86950 = 1 182 + }; 183 + 184 + enum { 185 + dot3ChipSetDigitalDC21040 = 1, 186 + dot3ChipSetDigitalDC21140 = 2, 187 + dot3ChipSetDigitalDC21041 = 3, 188 + dot3ChipSetDigitalDC21140A = 4, 189 + dot3ChipSetDigitalDC21142 = 5 190 + }; 191 + 192 + enum { 193 + dot3ChipSetWesternDigital83C690 = 1, 194 + dot3ChipSetWesternDigital83C790 = 2 195 + }; 196 + /* END of Ethernet-link MIB stuff */ 197 + 198 + /* 199 + * Put other types of interface MIBs here, or in interface-specific 200 + * header files if convenient ones already exist. 201 + */ 202 + 203 + /* 204 + * Structure for interface family ID table 205 + */ 206 + 207 + struct if_family_id { 208 + u_int32_t iffmid_len; 209 + u_int32_t iffmid_id; 210 + char iffmid_str[1]; /* variable length string */ 211 + }; 212 + 213 + 214 + #endif /* _NET_IF_MIB_H */
+154
platform-include/net/if_types.h
··· 1 + /* 2 + * Copyright (c) 2000-2010 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1989, 1993, 1994 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * @(#)if_types.h 8.2 (Berkeley) 4/20/94 61 + * $FreeBSD: src/sys/net/if_types.h,v 1.8.2.3 2001/07/03 11:01:41 ume Exp $ 62 + */ 63 + 64 + #ifndef _NET_IF_TYPES_H_ 65 + #define _NET_IF_TYPES_H_ 66 + #include <sys/appleapiopts.h> 67 + 68 + /* 69 + * Interface types for benefit of parsing media address headers. 70 + * This list is derived from the SNMP list of ifTypes, currently 71 + * documented in RFC1573. 72 + * The current list of assignments is maintained at: 73 + * http://www.iana.org/assignments/smi-numbers 74 + */ 75 + 76 + #define IFT_OTHER 0x1 /* none of the following */ 77 + #define IFT_1822 0x2 /* old-style arpanet imp */ 78 + #define IFT_HDH1822 0x3 /* HDH arpanet imp */ 79 + #define IFT_X25DDN 0x4 /* x25 to imp */ 80 + #define IFT_X25 0x5 /* PDN X25 interface (RFC877) */ 81 + #define IFT_ETHER 0x6 /* Ethernet CSMACD */ 82 + #define IFT_ISO88023 0x7 /* CMSA CD */ 83 + #define IFT_ISO88024 0x8 /* Token Bus */ 84 + #define IFT_ISO88025 0x9 /* Token Ring */ 85 + #define IFT_ISO88026 0xa /* MAN */ 86 + #define IFT_STARLAN 0xb 87 + #define IFT_P10 0xc /* Proteon 10MBit ring */ 88 + #define IFT_P80 0xd /* Proteon 80MBit ring */ 89 + #define IFT_HY 0xe /* Hyperchannel */ 90 + #define IFT_FDDI 0xf 91 + #define IFT_LAPB 0x10 92 + #define IFT_SDLC 0x11 93 + #define IFT_T1 0x12 94 + #define IFT_CEPT 0x13 /* E1 - european T1 */ 95 + #define IFT_ISDNBASIC 0x14 96 + #define IFT_ISDNPRIMARY 0x15 97 + #define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */ 98 + #define IFT_PPP 0x17 /* RFC 1331 */ 99 + #define IFT_LOOP 0x18 /* loopback */ 100 + #define IFT_EON 0x19 /* ISO over IP */ 101 + #define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */ 102 + #define IFT_NSIP 0x1b /* XNS over IP */ 103 + #define IFT_SLIP 0x1c /* IP over generic TTY */ 104 + #define IFT_ULTRA 0x1d /* Ultra Technologies */ 105 + #define IFT_DS3 0x1e /* Generic T3 */ 106 + #define IFT_SIP 0x1f /* SMDS */ 107 + #define IFT_FRELAY 0x20 /* Frame Relay DTE only */ 108 + #define IFT_RS232 0x21 109 + #define IFT_PARA 0x22 /* parallel-port */ 110 + #define IFT_ARCNET 0x23 111 + #define IFT_ARCNETPLUS 0x24 112 + #define IFT_ATM 0x25 /* ATM cells */ 113 + #define IFT_MIOX25 0x26 114 + #define IFT_SONET 0x27 /* SONET or SDH */ 115 + #define IFT_X25PLE 0x28 116 + #define IFT_ISO88022LLC 0x29 117 + #define IFT_LOCALTALK 0x2a 118 + #define IFT_SMDSDXI 0x2b 119 + #define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */ 120 + #define IFT_V35 0x2d 121 + #define IFT_HSSI 0x2e 122 + #define IFT_HIPPI 0x2f 123 + #define IFT_MODEM 0x30 /* Generic Modem */ 124 + #define IFT_AAL5 0x31 /* AAL5 over ATM */ 125 + #define IFT_SONETPATH 0x32 126 + #define IFT_SONETVT 0x33 127 + #define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */ 128 + #define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */ 129 + #define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */ 130 + #define IFT_GIF 0x37 /*0xf0*/ 131 + #define IFT_FAITH 0x38 /*0xf2*/ 132 + #define IFT_STF 0x39 /*0xf3*/ 133 + #define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */ 134 + #define IFT_IEEE8023ADLAG 0x88 /* IEEE802.3ad Link Aggregate */ 135 + #define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/ 136 + #define IFT_BRIDGE 0xd1 /* Transparent bridge interface */ 137 + 138 + /* 139 + * These are not based on IANA assignments: 140 + * Note: IFT_STF has a defined ifType: 0xd7 (215), but we use 0x39. 141 + */ 142 + #define IFT_GIF 0x37 /*0xf0*/ 143 + #define IFT_FAITH 0x38 /*0xf2*/ 144 + #define IFT_STF 0x39 /*0xf3*/ 145 + 146 + #define IFT_ENC 0xf4 /* Encapsulation */ 147 + #define IFT_PFLOG 0xf5 /* Packet filter logging */ 148 + #define IFT_PFSYNC 0xf6 /* Packet filter state syncing */ 149 + #define IFT_CARP 0xf8 /* Common Address Redundancy Protocol */ 150 + 151 + #define IFT_CELLULAR 0xff /* Packet Data over Cellular */ 152 + #define IFT_PDP IFT_CELLULAR /* deprecated; use IFT_CELLULAR */ 153 + 154 + #endif
+82
platform-include/net/if_utun.h
··· 1 + /* 2 + * Copyright (c) 2008-2011 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + 30 + #ifndef _NET_IF_UTUN_H_ 31 + #define _NET_IF_UTUN_H_ 32 + 33 + #include <net/if_utun_crypto.h> 34 + 35 + 36 + /* 37 + * Name registered by the utun kernel control 38 + */ 39 + #define UTUN_CONTROL_NAME "com.apple.net.utun_control" 40 + 41 + /* 42 + * Socket option names to manage utun 43 + */ 44 + #define UTUN_OPT_FLAGS 1 45 + #define UTUN_OPT_IFNAME 2 46 + #define UTUN_OPT_EXT_IFDATA_STATS 3 /* get|set (type int) */ 47 + #define UTUN_OPT_INC_IFDATA_STATS_IN 4 /* set to increment stat counters (type struct utun_stats_param) */ 48 + #define UTUN_OPT_INC_IFDATA_STATS_OUT 5 /* set to increment stat counters (type struct utun_stats_param) */ 49 + #define UTUN_OPT_ENABLE_CRYPTO 6 50 + #define UTUN_OPT_CONFIG_CRYPTO_KEYS 7 51 + #define UTUN_OPT_UNCONFIG_CRYPTO_KEYS 8 52 + #define UTUN_OPT_GENERATE_CRYPTO_KEYS_IDX 9 53 + #define UTUN_OPT_DISABLE_CRYPTO 10 54 + #define UTUN_OPT_STOP_CRYPTO_DATA_TRAFFIC 11 55 + #define UTUN_OPT_START_CRYPTO_DATA_TRAFFIC 12 56 + 57 + /* 58 + * Flags for by UTUN_OPT_FLAGS 59 + */ 60 + #define UTUN_FLAGS_NO_OUTPUT 0x0001 61 + #define UTUN_FLAGS_NO_INPUT 0x0002 62 + #define UTUN_FLAGS_CRYPTO 0x0004 63 + #define UTUN_FLAGS_CRYPTO_STOP_DATA_TRAFFIC 0x0008 64 + 65 + /* 66 + * utun packet type flags 67 + */ 68 + #define UTUN_PKT_TYPE_KEEPALIVE 0x0001 69 + #define UTUN_PKT_TYPE_IPSEC 0x0002 70 + #define UTUN_PKT_TYPE_DTLS 0x0004 71 + 72 + 73 + /* 74 + * utun stats parameter structure 75 + */ 76 + struct utun_stats_param { 77 + u_int64_t utsp_packets; 78 + u_int64_t utsp_bytes; 79 + u_int64_t utsp_errors; 80 + }; 81 + 82 + #endif
+222
platform-include/net/if_utun_crypto.h
··· 1 + /* 2 + * Copyright (c) 2011 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + #ifndef _NET_IF_UTUN_CRYPTO_H_ 30 + #define _NET_IF_UTUN_CRYPTO_H_ 31 + 32 + // constants used in configuring the crypto context 33 + typedef enum utun_crypto_ver { 34 + UTUN_CRYPTO_VER_1 = 1, 35 + UTUN_CRYPTO_VER_MAX, 36 + } utun_crypto_ver_t; 37 + 38 + #define UTUN_CRYPTO_KEYS_IPSEC_VER_1 UTUN_CRYPTO_VER_1 39 + #define UTUN_CRYPTO_IPSEC_VER_1 UTUN_CRYPTO_VER_1 40 + 41 + #define UTUN_CRYPTO_ARGS_VER_MAX UTUN_CRYPTO_VER_MAX 42 + #define UTUN_CRYPTO_KEYS_ARGS_VER_MAX UTUN_CRYPTO_VER_MAX 43 + 44 + typedef enum utun_crypto_dir { 45 + UTUN_CRYPTO_DIR_IN = 1, 46 + UTUN_CRYPTO_DIR_OUT, 47 + UTUN_CRYPTO_DIR_MAX, 48 + } utun_crypto_dir_t; 49 + 50 + #define UTUN_CRYPTO_CTX_NUM_DIRS 2 51 + 52 + #define BITSTOBYTES(n) (n >> 3) 53 + #define BYTESTOBITS(n) (n << 3) 54 + 55 + #define MAX_KEY_AUTH_LEN_BITS 512 // corresponds to SHA512 56 + #define MAX_KEY_AUTH_LEN_BYTES (BITSTOBYTES(MAX_KEY_AUTH_LEN_BITS)) 57 + #define MAX_KEY_ENC_LEN_BITS 256 // corresponds to AES256 58 + #define MAX_KEY_ENC_LEN_BYTES (BITSTOBYTES(MAX_KEY_ENC_LEN_BITS)) 59 + 60 + typedef enum utun_crypto_type { 61 + UTUN_CRYPTO_TYPE_IPSEC = 1, 62 + UTUN_CRYPTO_TYPE_DTLS, 63 + UTUN_CRYPTO_TYPE_MAX, 64 + } utun_crypto_type_t; 65 + 66 + typedef enum if_utun_crypto_ipsec_mode { 67 + IF_UTUN_CRYPTO_IPSEC_MODE_NONE = 0, 68 + IF_UTUN_CRYPTO_IPSEC_MODE_TRANSPORT, 69 + IF_UTUN_CRYPTO_IPSEC_MODE_TUNNEL, 70 + IF_UTUN_CRYPTO_IPSEC_MODE_MAX, 71 + } if_utun_crypto_ipsec_mode_t; 72 + 73 + typedef enum if_utun_crypto_ipsec_proto { 74 + IF_UTUN_CRYPTO_IPSEC_PROTO_NONE = 0, 75 + IF_UTUN_CRYPTO_IPSEC_PROTO_ESP, 76 + IF_UTUN_CRYPTO_IPSEC_PROTO_AH, 77 + IF_UTUN_CRYPTO_IPSEC_PROTO_MAX, 78 + } if_utun_crypto_ipsec_proto_t; 79 + 80 + typedef enum if_utun_crypto_ipsec_auth { 81 + IF_UTUN_CRYPTO_IPSEC_AUTH_NONE = 0, 82 + IF_UTUN_CRYPTO_IPSEC_AUTH_MD5, 83 + IF_UTUN_CRYPTO_IPSEC_AUTH_SHA1, 84 + IF_UTUN_CRYPTO_IPSEC_AUTH_SHA256, 85 + IF_UTUN_CRYPTO_IPSEC_AUTH_SHA384, 86 + IF_UTUN_CRYPTO_IPSEC_AUTH_SHA512, 87 + IF_UTUN_CRYPTO_IPSEC_AUTH_MAX, 88 + } if_utun_crypto_ipsec_auth_t; 89 + 90 + typedef enum if_utun_crypto_ipsec_enc { 91 + IF_UTUN_CRYPTO_IPSEC_ENC_NONE = 0, 92 + IF_UTUN_CRYPTO_IPSEC_ENC_DES, 93 + IF_UTUN_CRYPTO_IPSEC_ENC_3DES, 94 + IF_UTUN_CRYPTO_IPSEC_ENC_AES128, 95 + IF_UTUN_CRYPTO_IPSEC_ENC_AES256, 96 + IF_UTUN_CRYPTO_IPSEC_ENC_MAX, 97 + } if_utun_crypto_ipsec_enc_t; 98 + 99 + typedef enum if_utun_crypto_ipsec_keepalive { 100 + IF_UTUN_CRYPTO_IPSEC_KEEPALIVE_NONE = 0, 101 + IF_UTUN_CRYPTO_IPSEC_KEEPALIVE_NATT, 102 + IF_UTUN_CRYPTO_IPSEC_KEEPALIVE_ESP, 103 + IF_UTUN_CRYPTO_IPSEC_KEEPALIVE_MAX, 104 + } if_utun_crypto_ipsec_keepalive_t; 105 + 106 + typedef enum if_utun_crypto_ipsec_natd { 107 + IF_UTUN_CRYPTO_IPSEC_NATD_NONE = 0, 108 + IF_UTUN_CRYPTO_IPSEC_NATD_MINE, 109 + IF_UTUN_CRYPTO_IPSEC_NATD_PEER, 110 + IF_UTUN_CRYPTO_IPSEC_NATD_BOTH, 111 + IF_UTUN_CRYPTO_IPSEC_NATD_MAX, 112 + } if_utun_crypto_ipsec_natd_t; 113 + 114 + // structures used for storing the App's keying index arguments 115 + typedef struct utun_crypto_keys_idx_ipsec_args_v1 { 116 + struct sockaddr_storage src_addr; // v4 or v6 socket address (ignore port numbers) 117 + struct sockaddr_storage dst_addr; // v4 or v6 socket address (ignore port numbers) 118 + if_utun_crypto_ipsec_proto_t proto; 119 + if_utun_crypto_ipsec_mode_t mode; 120 + u_int32_t reqid; // policy's reqid, default to 0 for now since we are avoiding policies. 121 + u_int32_t spi; // 0 when requesting the index, otherwise it contains the resulting index 122 + u_int32_t spirange_min; // default to 0 123 + u_int32_t spirange_max; // default to 0xffffffff 124 + } __attribute__((packed)) utun_crypto_keys_idx_ipsec_args_v1_t; 125 + 126 + typedef struct utun_crypto_keys_idx_dtls_args_v1 { 127 + // stub for DTLS keying index arguments 128 + u_int32_t unused; // place holder 129 + } __attribute__((packed)) utun_crypto_keys_idx_dtls_args_v1_t; 130 + 131 + // App's parent structure for sending/storing keying index arguments 132 + typedef struct utun_crypto_keys_idx_args { 133 + utun_crypto_ver_t ver; 134 + utun_crypto_type_t type; 135 + utun_crypto_dir_t dir; 136 + u_int32_t args_ulen; 137 + u_int32_t varargs_buflen; 138 + union { 139 + // don't change the order, number, or size of elements above this line (in this struct). otherwise UTUN_CRYPTO_CTX_IDX_ARGS_HDR_SIZE breaks backwards compatibility 140 + utun_crypto_keys_idx_ipsec_args_v1_t ipsec_v1; 141 + utun_crypto_keys_idx_dtls_args_v1_t dtls_v1; 142 + // future (additional) versions of the arguments may be placed here 143 + } u; 144 + u_int8_t varargs_buf[0]; 145 + } __attribute__((aligned(4), packed)) utun_crypto_keys_idx_args_t; 146 + 147 + // structures used for storing the App's keying material arguments 148 + typedef struct utun_crypto_keys_ipsec_args_v1 { 149 + struct sockaddr_storage src_addr; // v4 or v6 socket address (ignore port numbers) 150 + struct sockaddr_storage dst_addr; // v4 or v6 socket address (ignore port numbers) 151 + if_utun_crypto_ipsec_proto_t proto; 152 + if_utun_crypto_ipsec_mode_t mode; 153 + if_utun_crypto_ipsec_auth_t alg_auth; 154 + if_utun_crypto_ipsec_enc_t alg_enc; 155 + if_utun_crypto_ipsec_keepalive_t keepalive; 156 + if_utun_crypto_ipsec_natd_t natd; 157 + u_int8_t replay; // window size default to 4 158 + u_int8_t punt_rx_keepalive; 159 + u_int16_t interval_tx_keepalive; 160 + u_int16_t key_auth_len; // 128 or 160 or 192 or 256 or 384 or 512 161 + u_int16_t key_enc_len; // 64 or 128 or 192 or 256 162 + u_int16_t natt_port; // if non-zero flags will be set to include SADB_X_EXT_NATT 163 + u_int16_t unused; 164 + u_int32_t seq; // default to 0 165 + u_int32_t spi; 166 + u_int32_t pid; // vpnagent's process id 167 + u_int32_t reqid; // policy's reqid, default to 0 for now since we are avoiding policies. 168 + u_int64_t lifetime_hard; // value in seconds 169 + u_int64_t lifetime_soft; // value in seconds 170 + // key_auth and key_enc will actually be stored in utun_crypto_KEYS_args_t.varargs_buf 171 + } __attribute__((packed)) utun_crypto_keys_ipsec_args_v1_t; 172 + 173 + typedef struct utun_crypto_ctx_dtls_mat_args_v1 { 174 + // stub for DTLS keying material arguments 175 + u_int32_t unused; // place holder 176 + } __attribute__((packed)) utun_crypto_keys_dtls_args_v1_t; 177 + 178 + // App's parent structure for sending/storing keying material arguments 179 + typedef struct utun_crypto_keys_args { 180 + utun_crypto_ver_t ver; 181 + utun_crypto_type_t type; 182 + utun_crypto_dir_t dir; 183 + u_int32_t args_ulen; 184 + u_int32_t varargs_buflen; 185 + union { 186 + // don't change the order, number, or size of elements above this line (in this struct). otherwise UTUN_CRYPTO_KEYS_ARGS_HDR_SIZE breaks backwards compatibility 187 + utun_crypto_keys_ipsec_args_v1_t ipsec_v1; 188 + utun_crypto_keys_dtls_args_v1_t dtls_v1; 189 + // future (additional) versions of the arguments may be placed here 190 + } u; 191 + u_int8_t varargs_buf[0]; 192 + } __attribute__((aligned(4), packed)) utun_crypto_keys_args_t; 193 + 194 + // structures used for storing the App's crypto arguments 195 + typedef struct utun_crypto_ipsec_args_v1 { 196 + // stub for IPSec crypto context arguments 197 + u_int32_t unused; // place holder 198 + } __attribute__((packed)) utun_crypto_ipsec_args_v1_t; 199 + 200 + typedef struct utun_crypto_dtls_args_v1 { 201 + // stub for DTLS crypto context arguments 202 + u_int32_t unused; // place holder 203 + } __attribute__((packed)) utun_crypto_dtls_args_v1_t; 204 + 205 + // App's parent structure for starting/stopping crypto 206 + typedef struct utun_crypto_args { 207 + utun_crypto_ver_t ver; 208 + utun_crypto_type_t type; 209 + u_int32_t stop_data_traffic; 210 + u_int32_t args_ulen; 211 + u_int32_t varargs_buflen; 212 + union { 213 + // don't change the order, number, or size of elements above this line (in this struct). otherwise UTUN_CRYPTO_ARGS_HDR_SIZE breaks backwards compatibility 214 + utun_crypto_ipsec_args_v1_t ipsec_v1; 215 + utun_crypto_dtls_args_v1_t dtls_v1; 216 + // future (additional) versions of the arguments may be placed here 217 + } u; 218 + u_int8_t varargs_buf[0]; // must be at the end of this struct 219 + } __attribute__((aligned(4), packed)) utun_crypto_args_t; 220 + 221 + 222 + #endif // _NET_IF_UTUN_CRYPTO_H_
+33
platform-include/net/if_utun_crypto_ipsec.h
··· 1 + /* 2 + * Copyright (c) 2011 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + #ifndef _NET_IF_UTUN_CRYPTO_IPSEC_H_ 30 + #define _NET_IF_UTUN_CRYPTO_IPSEC_H_ 31 + 32 + 33 + #endif // _NET_IF_UTUN_CRYPTO_IPSEC_H_
+236
platform-include/net/if_var.h
··· 1 + /* 2 + * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1982, 1986, 1989, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 61 + * $FreeBSD: src/sys/net/if_var.h,v 1.18.2.7 2001/07/24 19:10:18 brooks Exp $ 62 + */ 63 + 64 + #ifndef _NET_IF_VAR_H_ 65 + #define _NET_IF_VAR_H_ 66 + 67 + #include <sys/appleapiopts.h> 68 + #include <stdint.h> 69 + #include <sys/types.h> 70 + #include <sys/time.h> 71 + #include <sys/queue.h> /* get TAILQ macros */ 72 + 73 + 74 + #ifdef __APPLE__ 75 + #define APPLE_IF_FAM_LOOPBACK 1 76 + #define APPLE_IF_FAM_ETHERNET 2 77 + #define APPLE_IF_FAM_SLIP 3 78 + #define APPLE_IF_FAM_TUN 4 79 + #define APPLE_IF_FAM_VLAN 5 80 + #define APPLE_IF_FAM_PPP 6 81 + #define APPLE_IF_FAM_PVC 7 82 + #define APPLE_IF_FAM_DISC 8 83 + #define APPLE_IF_FAM_MDECAP 9 84 + #define APPLE_IF_FAM_GIF 10 85 + #define APPLE_IF_FAM_FAITH 11 /* deprecated */ 86 + #define APPLE_IF_FAM_STF 12 87 + #define APPLE_IF_FAM_FIREWIRE 13 88 + #define APPLE_IF_FAM_BOND 14 89 + #endif /* __APPLE__ */ 90 + 91 + /* 92 + * 72 was chosen below because it is the size of a TCP/IP 93 + * header (40) + the minimum mss (32). 94 + */ 95 + #define IF_MINMTU 72 96 + #define IF_MAXMTU 65535 97 + 98 + /* 99 + * Structures defining a network interface, providing a packet 100 + * transport mechanism (ala level 0 of the PUP protocols). 101 + * 102 + * Each interface accepts output datagrams of a specified maximum 103 + * length, and provides higher level routines with input datagrams 104 + * received from its medium. 105 + * 106 + * Output occurs when the routine if_output is called, with three parameters: 107 + * (*ifp->if_output)(ifp, m, dst, rt) 108 + * Here m is the mbuf chain to be sent and dst is the destination address. 109 + * The output routine encapsulates the supplied datagram if necessary, 110 + * and then transmits it on its medium. 111 + * 112 + * On input, each interface unwraps the data received by it, and either 113 + * places it on the input queue of a internetwork datagram routine 114 + * and posts the associated software interrupt, or passes the datagram to a raw 115 + * packet input routine. 116 + * 117 + * Routines exist for locating interfaces by their addresses 118 + * or for locating a interface on a certain network, as well as more general 119 + * routing and gateway routines maintaining information used to locate 120 + * interfaces. These routines live in the files if.c and route.c 121 + */ 122 + 123 + #define IFNAMSIZ 16 124 + 125 + /* This belongs up in socket.h or socketvar.h, depending on how far the 126 + * event bubbles up. 127 + */ 128 + 129 + struct net_event_data { 130 + u_int32_t if_family; 131 + u_int32_t if_unit; 132 + char if_name[IFNAMSIZ]; 133 + }; 134 + 135 + #if defined(__LP64__) 136 + #define __need_struct_timeval32 137 + #include <sys/_structs.h> 138 + #include <sys/_types/_timeval32.h> 139 + #define IF_DATA_TIMEVAL timeval32 140 + #else 141 + #define IF_DATA_TIMEVAL timeval 142 + #endif 143 + 144 + #pragma pack(4) 145 + 146 + /* 147 + * Structure describing information about an interface 148 + * which may be of interest to management entities. 149 + */ 150 + struct if_data { 151 + /* generic interface information */ 152 + u_char ifi_type; /* ethernet, tokenring, etc */ 153 + u_char ifi_typelen; /* Length of frame type id */ 154 + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ 155 + u_char ifi_addrlen; /* media address length */ 156 + u_char ifi_hdrlen; /* media header length */ 157 + u_char ifi_recvquota; /* polling quota for receive intrs */ 158 + u_char ifi_xmitquota; /* polling quota for xmit intrs */ 159 + u_char ifi_unused1; /* for future use */ 160 + u_int32_t ifi_mtu; /* maximum transmission unit */ 161 + u_int32_t ifi_metric; /* routing metric (external only) */ 162 + u_int32_t ifi_baudrate; /* linespeed */ 163 + /* volatile statistics */ 164 + u_int32_t ifi_ipackets; /* packets received on interface */ 165 + u_int32_t ifi_ierrors; /* input errors on interface */ 166 + u_int32_t ifi_opackets; /* packets sent on interface */ 167 + u_int32_t ifi_oerrors; /* output errors on interface */ 168 + u_int32_t ifi_collisions; /* collisions on csma interfaces */ 169 + u_int32_t ifi_ibytes; /* total number of octets received */ 170 + u_int32_t ifi_obytes; /* total number of octets sent */ 171 + u_int32_t ifi_imcasts; /* packets received via multicast */ 172 + u_int32_t ifi_omcasts; /* packets sent via multicast */ 173 + u_int32_t ifi_iqdrops; /* dropped on input, this interface */ 174 + u_int32_t ifi_noproto; /* destined for unsupported protocol */ 175 + u_int32_t ifi_recvtiming; /* usec spent receiving when timing */ 176 + u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */ 177 + struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */ 178 + u_int32_t ifi_unused2; /* used to be the default_proto */ 179 + u_int32_t ifi_hwassist; /* HW offload capabilities */ 180 + u_int32_t ifi_reserved1; /* for future use */ 181 + u_int32_t ifi_reserved2; /* for future use */ 182 + }; 183 + 184 + /* 185 + * Structure describing information about an interface 186 + * which may be of interest to management entities. 187 + */ 188 + struct if_data64 { 189 + /* generic interface information */ 190 + u_char ifi_type; /* ethernet, tokenring, etc */ 191 + u_char ifi_typelen; /* Length of frame type id */ 192 + u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ 193 + u_char ifi_addrlen; /* media address length */ 194 + u_char ifi_hdrlen; /* media header length */ 195 + u_char ifi_recvquota; /* polling quota for receive intrs */ 196 + u_char ifi_xmitquota; /* polling quota for xmit intrs */ 197 + u_char ifi_unused1; /* for future use */ 198 + u_int32_t ifi_mtu; /* maximum transmission unit */ 199 + u_int32_t ifi_metric; /* routing metric (external only) */ 200 + u_int64_t ifi_baudrate; /* linespeed */ 201 + /* volatile statistics */ 202 + u_int64_t ifi_ipackets; /* packets received on interface */ 203 + u_int64_t ifi_ierrors; /* input errors on interface */ 204 + u_int64_t ifi_opackets; /* packets sent on interface */ 205 + u_int64_t ifi_oerrors; /* output errors on interface */ 206 + u_int64_t ifi_collisions; /* collisions on csma interfaces */ 207 + u_int64_t ifi_ibytes; /* total number of octets received */ 208 + u_int64_t ifi_obytes; /* total number of octets sent */ 209 + u_int64_t ifi_imcasts; /* packets received via multicast */ 210 + u_int64_t ifi_omcasts; /* packets sent via multicast */ 211 + u_int64_t ifi_iqdrops; /* dropped on input, this interface */ 212 + u_int64_t ifi_noproto; /* destined for unsupported protocol */ 213 + u_int32_t ifi_recvtiming; /* usec spent receiving when timing */ 214 + u_int32_t ifi_xmittiming; /* usec spent xmitting when timing */ 215 + struct IF_DATA_TIMEVAL ifi_lastchange; /* time of last administrative change */ 216 + }; 217 + 218 + 219 + #pragma pack() 220 + 221 + /* 222 + * Structure defining a queue for a network interface. 223 + */ 224 + struct ifqueue { 225 + void *ifq_head; 226 + void *ifq_tail; 227 + int ifq_len; 228 + int ifq_maxlen; 229 + int ifq_drops; 230 + }; 231 + 232 + 233 + 234 + 235 + 236 + #endif /* !_NET_IF_VAR_H_ */
+68
platform-include/net/kext_net.h
··· 1 + /* 2 + * Copyright (c) 1999-2006 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + 29 + /* 30 + * Support for socket filter kernel extensions 31 + */ 32 + 33 + #ifndef NET_KEXT_NET_H 34 + #define NET_KEXT_NET_H 35 + 36 + #include <sys/appleapiopts.h> 37 + 38 + #include <sys/queue.h> 39 + #include <sys/cdefs.h> 40 + 41 + 42 + #define NFF_BEFORE 0x01 43 + #define NFF_AFTER 0x02 44 + 45 + #define NKE_OK 0 46 + #define NKE_REMOVE -1 47 + 48 + /* 49 + * Interface structure for inserting an installed socket NKE into an 50 + * existing socket. 51 + * 'handle' is the NKE to be inserted, 'where' is an insertion point, 52 + * and flags dictate the position of the to-be-inserted NKE relative to 53 + * the 'where' NKE. If the latter is NULL, the flags indicate "first" 54 + * or "last" 55 + */ 56 + #pragma pack(4) 57 + 58 + struct so_nke 59 + { unsigned int nke_handle; 60 + unsigned int nke_where; 61 + int nke_flags; /* NFF_BEFORE, NFF_AFTER: net/kext_net.h */ 62 + u_int32_t reserved[4]; /* for future use */ 63 + }; 64 + 65 + #pragma pack() 66 + 67 + #endif /* NET_KEXT_NET_H */ 68 +
+161
platform-include/net/ndrv.h
··· 1 + /* 2 + * Copyright (c) 2008 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* Copyright (c) 1997, 1998 Apple Computer, Inc. All Rights Reserved */ 29 + /* 30 + * @(#)ndrv.h 1.1 (MacOSX) 6/10/43 31 + * Justin Walker - 970604 32 + */ 33 + #include <net/dlil.h> 34 + 35 + #ifndef _NET_NDRV_H 36 + #define _NET_NDRV_H 37 + #include <sys/appleapiopts.h> 38 + 39 + 40 + struct sockaddr_ndrv 41 + { 42 + unsigned char snd_len; 43 + unsigned char snd_family; 44 + unsigned char snd_name[IFNAMSIZ]; /* from if.h */ 45 + }; 46 + 47 + /* 48 + * Support for user-mode protocol handlers 49 + */ 50 + 51 + #define NDRV_DEMUXTYPE_ETHERTYPE 4 52 + #define NDRV_DEMUXTYPE_SAP 5 53 + #define NDRV_DEMUXTYPE_SNAP 6 54 + 55 + #define NDRVPROTO_NDRV 0 56 + 57 + /* 58 + * Struct: ndrv_demux_desc 59 + * Purpose: 60 + * To uniquely identify a packet based on its low-level framing information. 61 + * 62 + * Fields: 63 + * type : type of protocol in data field, must be understood by 64 + * the interface family of the interface the socket is bound to 65 + * length : length of protocol data in "data" field 66 + * data : union of framing-specific data, in network byte order 67 + * ether_type : ethernet type in network byte order, assuming 68 + * ethernet type II framing 69 + * sap : first 3 bytes of sap header, network byte order 70 + * snap : first 5 bytes of snap header, network byte order 71 + * other : up to 28 bytes of protocol data for different protocol type 72 + * 73 + * Examples: 74 + * 1) 802.1x uses ether_type 0x888e, so the descriptor would be set as: 75 + * struct ndrv_demux_desc desc; 76 + * desc.type = NDRV_DEMUXTYPE_ETHERTYPE 77 + * desc.length = sizeof(unsigned short); 78 + * desc.ether_type = htons(0x888e); 79 + * 2) AppleTalk uses SNAP 0x080007809B 80 + * struct ndrv_demux_desc desc; 81 + * desc.type = NDRV_DEMUXTYPE_SNAP; 82 + * desc.length = 5; 83 + * desc.data.snap[0] = 08; 84 + * desc.data.snap[1] = 00; 85 + * desc.data.snap[2] = 07; 86 + * desc.data.snap[3] = 80; 87 + * desc.data.snap[4] = 9B; 88 + */ 89 + struct ndrv_demux_desc 90 + { 91 + u_int16_t type; 92 + u_int16_t length; 93 + union 94 + { 95 + u_int16_t ether_type; 96 + u_int8_t sap[3]; 97 + u_int8_t snap[5]; 98 + u_int8_t other[28]; 99 + } data; 100 + }; 101 + 102 + #define NDRV_PROTOCOL_DESC_VERS 1 103 + 104 + /* 105 + * Struct: ndrv_protocol_desc 106 + * Purpose: 107 + * Used to "bind" an NDRV socket so that packets that match 108 + * given protocol demux descriptions can be received: 109 + * Field: 110 + * version : must be NDRV_PROTOCOL_DESC_VERS 111 + * protocol_family : unique identifier for this protocol 112 + * demux_count : number of demux_list descriptors in demux_list; maximum of 10 113 + * demux_list : pointer to array of demux descriptors 114 + */ 115 + struct ndrv_protocol_desc 116 + { 117 + u_int32_t version; 118 + u_int32_t protocol_family; 119 + u_int32_t demux_count; 120 + struct ndrv_demux_desc *demux_list; 121 + }; 122 + 123 + 124 + #define SOL_NDRVPROTO NDRVPROTO_NDRV /* Use this socket level */ 125 + #define NDRV_DELDMXSPEC 0x02 /* Delete the registered protocol */ 126 + #define NDRV_SETDMXSPEC 0x04 /* Set the protocol spec */ 127 + #define NDRV_ADDMULTICAST 0x05 /* Add a physical multicast address */ 128 + #define NDRV_DELMULTICAST 0x06 /* Delete a phyiscal multicast */ 129 + 130 + /* 131 + * SOL_NDRVPROTO - use this for the socket level when calling setsocketopt 132 + * NDRV_DELDMXSPEC - removes the registered protocol and all related demuxes 133 + * NDRV_SETDMXSPEC - set the protocol to receive, use struct ndrv_protocol_desc 134 + * as the parameter. 135 + * NDRV_ADDMULTICAST - Enable reception of a phyiscal multicast address, use 136 + * a sockaddr of the appropriate type for the media in use. 137 + * NDRV_DELMULTICAST - Disable reception of a phyiscal multicast address, use 138 + * a sockaddr of the appropriate type for the media in use. 139 + * 140 + * When adding multicasts, the multicasts are ref counted. If the multicast is 141 + * already registered in the kernel, the count will be bumped. When deleting 142 + * the multicast, the count is decremented. If the count reaches zero the 143 + * multicast is removed. If your process is killed, PF_NDRV will unregister 144 + * the mulitcasts you've added. You can only delete multicasts you've added 145 + * on the same socket. 146 + * 147 + * If the interface goes away while your socket is open, your protocol is 148 + * immediately detached and sending/receiving is disabled on the socket. 149 + * If you need a chance to do something, please file a bug and we can give 150 + * you a second or two. 151 + */ 152 + 153 + /* Max number of descriptions allowed by default */ 154 + #define NDRV_DMUX_MAX_DESCR 1024 155 + 156 + /* 157 + * sysctl MIB tags at the kern.ipc.nrdv level 158 + */ 159 + #define NRDV_MULTICAST_ADDRS_PER_SOCK 1 /* to toggle NDRV_DMUX_MAX_DESCR value */ 160 + 161 + #endif /* _NET_NDRV_H */
+449
platform-include/net/pfkeyv2.h
··· 1 + /* 2 + * Copyright (c) 2000-2011 Apple Computer, Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* $KAME: pfkeyv2.h,v 1.10 2000/03/22 07:04:20 sakane Exp $ */ 29 + 30 + /* 31 + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 32 + * All rights reserved. 33 + * 34 + * Redistribution and use in source and binary forms, with or without 35 + * modification, are permitted provided that the following conditions 36 + * are met: 37 + * 1. Redistributions of source code must retain the above copyright 38 + * notice, this list of conditions and the following disclaimer. 39 + * 2. Redistributions in binary form must reproduce the above copyright 40 + * notice, this list of conditions and the following disclaimer in the 41 + * documentation and/or other materials provided with the distribution. 42 + * 3. Neither the name of the project nor the names of its contributors 43 + * may be used to endorse or promote products derived from this software 44 + * without specific prior written permission. 45 + * 46 + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 47 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 49 + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 50 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 + * SUCH DAMAGE. 57 + */ 58 + 59 + /* 60 + * This file has been derived rfc 2367, 61 + * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_. 62 + * sakane@ydc.co.jp 63 + */ 64 + 65 + #ifndef _NET_PFKEYV2_H_ 66 + #define _NET_PFKEYV2_H_ 67 + #include <sys/appleapiopts.h> 68 + 69 + /* 70 + This file defines structures and symbols for the PF_KEY Version 2 71 + key management interface. It was written at the U.S. Naval Research 72 + Laboratory. This file is in the public domain. The authors ask that 73 + you leave this credit intact on any copies of this file. 74 + */ 75 + #ifndef __PFKEY_V2_H 76 + #define __PFKEY_V2_H 1 77 + 78 + #define PF_KEY_V2 2 79 + #define PFKEYV2_REVISION 199806L 80 + 81 + #define SADB_RESERVED 0 82 + #define SADB_GETSPI 1 83 + #define SADB_UPDATE 2 84 + #define SADB_ADD 3 85 + #define SADB_DELETE 4 86 + #define SADB_GET 5 87 + #define SADB_ACQUIRE 6 88 + #define SADB_REGISTER 7 89 + #define SADB_EXPIRE 8 90 + #define SADB_FLUSH 9 91 + #define SADB_DUMP 10 92 + #define SADB_X_PROMISC 11 93 + #define SADB_X_PCHANGE 12 94 + 95 + #define SADB_X_SPDUPDATE 13 96 + #define SADB_X_SPDADD 14 97 + #define SADB_X_SPDDELETE 15 /* by policy index */ 98 + #define SADB_X_SPDGET 16 99 + #define SADB_X_SPDACQUIRE 17 100 + #define SADB_X_SPDDUMP 18 101 + #define SADB_X_SPDFLUSH 19 102 + #define SADB_X_SPDSETIDX 20 103 + #define SADB_X_SPDEXPIRE 21 104 + #define SADB_X_SPDDELETE2 22 /* by policy id */ 105 + #define SADB_GETSASTAT 23 106 + #define SADB_MAX 23 107 + 108 + struct sadb_msg { 109 + u_int8_t sadb_msg_version; 110 + u_int8_t sadb_msg_type; 111 + u_int8_t sadb_msg_errno; 112 + u_int8_t sadb_msg_satype; 113 + u_int16_t sadb_msg_len; 114 + u_int16_t sadb_msg_reserved; 115 + u_int32_t sadb_msg_seq; 116 + u_int32_t sadb_msg_pid; 117 + }; 118 + 119 + struct sadb_ext { 120 + u_int16_t sadb_ext_len; 121 + u_int16_t sadb_ext_type; 122 + }; 123 + 124 + struct sadb_sa { 125 + u_int16_t sadb_sa_len; 126 + u_int16_t sadb_sa_exttype; 127 + u_int32_t sadb_sa_spi; 128 + u_int8_t sadb_sa_replay; 129 + u_int8_t sadb_sa_state; 130 + u_int8_t sadb_sa_auth; 131 + u_int8_t sadb_sa_encrypt; 132 + u_int32_t sadb_sa_flags; 133 + }; 134 + 135 + 136 + struct sadb_lifetime { 137 + u_int16_t sadb_lifetime_len; 138 + u_int16_t sadb_lifetime_exttype; 139 + u_int32_t sadb_lifetime_allocations; 140 + u_int64_t sadb_lifetime_bytes; 141 + u_int64_t sadb_lifetime_addtime; 142 + u_int64_t sadb_lifetime_usetime; 143 + }; 144 + 145 + struct sadb_address { 146 + u_int16_t sadb_address_len; 147 + u_int16_t sadb_address_exttype; 148 + u_int8_t sadb_address_proto; 149 + u_int8_t sadb_address_prefixlen; 150 + u_int16_t sadb_address_reserved; 151 + }; 152 + 153 + struct sadb_key { 154 + u_int16_t sadb_key_len; 155 + u_int16_t sadb_key_exttype; 156 + u_int16_t sadb_key_bits; 157 + u_int16_t sadb_key_reserved; 158 + }; 159 + 160 + struct sadb_ident { 161 + u_int16_t sadb_ident_len; 162 + u_int16_t sadb_ident_exttype; 163 + u_int16_t sadb_ident_type; 164 + u_int16_t sadb_ident_reserved; 165 + u_int64_t sadb_ident_id; 166 + }; 167 + 168 + struct sadb_sens { 169 + u_int16_t sadb_sens_len; 170 + u_int16_t sadb_sens_exttype; 171 + u_int32_t sadb_sens_dpd; 172 + u_int8_t sadb_sens_sens_level; 173 + u_int8_t sadb_sens_sens_len; 174 + u_int8_t sadb_sens_integ_level; 175 + u_int8_t sadb_sens_integ_len; 176 + u_int32_t sadb_sens_reserved; 177 + }; 178 + 179 + struct sadb_prop { 180 + u_int16_t sadb_prop_len; 181 + u_int16_t sadb_prop_exttype; 182 + u_int8_t sadb_prop_replay; 183 + u_int8_t sadb_prop_reserved[3]; 184 + }; 185 + 186 + struct sadb_comb { 187 + u_int8_t sadb_comb_auth; 188 + u_int8_t sadb_comb_encrypt; 189 + u_int16_t sadb_comb_flags; 190 + u_int16_t sadb_comb_auth_minbits; 191 + u_int16_t sadb_comb_auth_maxbits; 192 + u_int16_t sadb_comb_encrypt_minbits; 193 + u_int16_t sadb_comb_encrypt_maxbits; 194 + u_int32_t sadb_comb_reserved; 195 + u_int32_t sadb_comb_soft_allocations; 196 + u_int32_t sadb_comb_hard_allocations; 197 + u_int64_t sadb_comb_soft_bytes; 198 + u_int64_t sadb_comb_hard_bytes; 199 + u_int64_t sadb_comb_soft_addtime; 200 + u_int64_t sadb_comb_hard_addtime; 201 + u_int64_t sadb_comb_soft_usetime; 202 + u_int64_t sadb_comb_hard_usetime; 203 + }; 204 + 205 + struct sadb_supported { 206 + u_int16_t sadb_supported_len; 207 + u_int16_t sadb_supported_exttype; 208 + u_int32_t sadb_supported_reserved; 209 + }; 210 + 211 + struct sadb_alg { 212 + u_int8_t sadb_alg_id; 213 + u_int8_t sadb_alg_ivlen; 214 + u_int16_t sadb_alg_minbits; 215 + u_int16_t sadb_alg_maxbits; 216 + u_int16_t sadb_alg_reserved; 217 + }; 218 + 219 + struct sadb_spirange { 220 + u_int16_t sadb_spirange_len; 221 + u_int16_t sadb_spirange_exttype; 222 + u_int32_t sadb_spirange_min; 223 + u_int32_t sadb_spirange_max; 224 + u_int32_t sadb_spirange_reserved; 225 + }; 226 + 227 + struct sadb_x_kmprivate { 228 + u_int16_t sadb_x_kmprivate_len; 229 + u_int16_t sadb_x_kmprivate_exttype; 230 + u_int32_t sadb_x_kmprivate_reserved; 231 + }; 232 + 233 + /* 234 + * XXX Additional SA Extension. 235 + * mode: tunnel or transport 236 + * reqid: to make SA unique nevertheless the address pair of SA are same. 237 + * Mainly it's for VPN. 238 + */ 239 + struct sadb_x_sa2 { 240 + u_int16_t sadb_x_sa2_len; 241 + u_int16_t sadb_x_sa2_exttype; 242 + u_int8_t sadb_x_sa2_mode; 243 + u_int8_t sadb_x_sa2_reserved1; 244 + u_int16_t sadb_x_sa2_reserved2; 245 + u_int32_t sadb_x_sa2_sequence; 246 + u_int32_t sadb_x_sa2_reqid; 247 + }; 248 + 249 + /* XXX Policy Extension */ 250 + /* sizeof(struct sadb_x_policy) == 16 */ 251 + struct sadb_x_policy { 252 + u_int16_t sadb_x_policy_len; 253 + u_int16_t sadb_x_policy_exttype; 254 + u_int16_t sadb_x_policy_type; /* See policy type of ipsec.h */ 255 + u_int8_t sadb_x_policy_dir; /* direction, see ipsec.h */ 256 + u_int8_t sadb_x_policy_reserved; 257 + u_int32_t sadb_x_policy_id; 258 + u_int32_t sadb_x_policy_reserved2; 259 + }; 260 + /* 261 + * When policy_type == IPSEC, it is followed by some of 262 + * the ipsec policy request. 263 + * [total length of ipsec policy requests] 264 + * = (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy)) 265 + */ 266 + 267 + /* XXX IPsec Policy Request Extension */ 268 + /* 269 + * This structure is aligned 8 bytes. 270 + */ 271 + struct sadb_x_ipsecrequest { 272 + u_int16_t sadb_x_ipsecrequest_len; /* structure length aligned to 8 bytes. 273 + * This value is true length of bytes. 274 + * Not in units of 64 bits. */ 275 + u_int16_t sadb_x_ipsecrequest_proto; /* See ipsec.h */ 276 + u_int8_t sadb_x_ipsecrequest_mode; /* See IPSEC_MODE_XX in ipsec.h. */ 277 + u_int8_t sadb_x_ipsecrequest_level; /* See IPSEC_LEVEL_XX in ipsec.h */ 278 + u_int16_t sadb_x_ipsecrequest_reqid; /* See ipsec.h */ 279 + 280 + /* 281 + * followed by source IP address of SA, and immediately followed by 282 + * destination IP address of SA. These encoded into two of sockaddr 283 + * structure without any padding. Must set each sa_len exactly. 284 + * Each of length of the sockaddr structure are not aligned to 64bits, 285 + * but sum of x_request and addresses is aligned to 64bits. 286 + */ 287 + }; 288 + 289 + struct sadb_session_id { 290 + u_int16_t sadb_session_id_len; 291 + u_int16_t sadb_session_id_exttype; 292 + /* [0] is an arbitrary handle that means something only for requester 293 + * [1] is a global session id for lookups in the kernel and racoon. 294 + */ 295 + u_int64_t sadb_session_id_v[2]; 296 + } __attribute__ ((aligned(8))); 297 + 298 + struct sastat { 299 + u_int32_t spi; /* SPI Value, network byte order */ 300 + u_int32_t created; /* for lifetime */ 301 + struct sadb_lifetime lft_c; /* CURRENT lifetime. */ 302 + }; // no need to align 303 + 304 + struct sadb_sastat { 305 + u_int16_t sadb_sastat_len; 306 + u_int16_t sadb_sastat_exttype; 307 + u_int32_t sadb_sastat_dir; 308 + u_int32_t sadb_sastat_reserved; 309 + u_int32_t sadb_sastat_list_len; 310 + /* list of struct sastat comes after */ 311 + } __attribute__ ((aligned(8))); 312 + 313 + #define SADB_EXT_RESERVED 0 314 + #define SADB_EXT_SA 1 315 + #define SADB_EXT_LIFETIME_CURRENT 2 316 + #define SADB_EXT_LIFETIME_HARD 3 317 + #define SADB_EXT_LIFETIME_SOFT 4 318 + #define SADB_EXT_ADDRESS_SRC 5 319 + #define SADB_EXT_ADDRESS_DST 6 320 + #define SADB_EXT_ADDRESS_PROXY 7 321 + #define SADB_EXT_KEY_AUTH 8 322 + #define SADB_EXT_KEY_ENCRYPT 9 323 + #define SADB_EXT_IDENTITY_SRC 10 324 + #define SADB_EXT_IDENTITY_DST 11 325 + #define SADB_EXT_SENSITIVITY 12 326 + #define SADB_EXT_PROPOSAL 13 327 + #define SADB_EXT_SUPPORTED_AUTH 14 328 + #define SADB_EXT_SUPPORTED_ENCRYPT 15 329 + #define SADB_EXT_SPIRANGE 16 330 + #define SADB_X_EXT_KMPRIVATE 17 331 + #define SADB_X_EXT_POLICY 18 332 + #define SADB_X_EXT_SA2 19 333 + #define SADB_EXT_SESSION_ID 20 334 + #define SADB_EXT_SASTAT 21 335 + #define SADB_EXT_MAX 21 336 + 337 + #define SADB_SATYPE_UNSPEC 0 338 + #define SADB_SATYPE_AH 2 339 + #define SADB_SATYPE_ESP 3 340 + #define SADB_SATYPE_RSVP 5 341 + #define SADB_SATYPE_OSPFV2 6 342 + #define SADB_SATYPE_RIPV2 7 343 + #define SADB_SATYPE_MIP 8 344 + #define SADB_X_SATYPE_IPCOMP 9 345 + #define SADB_X_SATYPE_POLICY 10 346 + #define SADB_SATYPE_MAX 11 347 + 348 + #define SADB_SASTATE_LARVAL 0 349 + #define SADB_SASTATE_MATURE 1 350 + #define SADB_SASTATE_DYING 2 351 + #define SADB_SASTATE_DEAD 3 352 + #define SADB_SASTATE_MAX 3 353 + 354 + #define SADB_SAFLAGS_PFS 1 355 + 356 + /* RFC2367 numbers - meets RFC2407 */ 357 + #define SADB_AALG_NONE 0 358 + #define SADB_AALG_MD5HMAC 1 /*2*/ 359 + #define SADB_AALG_SHA1HMAC 2 /*3*/ 360 + #define SADB_AALG_MAX 8 361 + /* private allocations - based on RFC2407/IANA assignment */ 362 + #define SADB_X_AALG_SHA2_256 6 /*5*/ 363 + #define SADB_X_AALG_SHA2_384 7 /*6*/ 364 + #define SADB_X_AALG_SHA2_512 8 /*7*/ 365 + /* private allocations should use 249-255 (RFC2407) */ 366 + #define SADB_X_AALG_MD5 3 /*249*/ /* Keyed MD5 */ 367 + #define SADB_X_AALG_SHA 4 /*250*/ /* Keyed SHA */ 368 + #define SADB_X_AALG_NULL 5 /*251*/ /* null authentication */ 369 + 370 + /* RFC2367 numbers - meets RFC2407 */ 371 + #define SADB_EALG_NONE 0 372 + #define SADB_EALG_DESCBC 1 /*2*/ 373 + #define SADB_EALG_3DESCBC 2 /*3*/ 374 + #define SADB_EALG_NULL 3 /*11*/ 375 + #define SADB_EALG_MAX 12 376 + /* private allocations - based on RFC2407/IANA assignment */ 377 + #define SADB_X_EALG_CAST128CBC 5 /*6*/ 378 + #define SADB_X_EALG_BLOWFISHCBC 4 /*7*/ 379 + #define SADB_X_EALG_RIJNDAELCBC 12 380 + #define SADB_X_EALG_AESCBC 12 381 + #define SADB_X_EALG_AES 12 382 + /* private allocations should use 249-255 (RFC2407) */ 383 + 384 + #if 1 /*nonstandard */ 385 + #define SADB_X_CALG_NONE 0 386 + #define SADB_X_CALG_OUI 1 387 + #define SADB_X_CALG_DEFLATE 2 388 + #define SADB_X_CALG_LZS 3 389 + #define SADB_X_CALG_MAX 4 390 + #endif 391 + 392 + #define SADB_IDENTTYPE_RESERVED 0 393 + #define SADB_IDENTTYPE_PREFIX 1 394 + #define SADB_IDENTTYPE_FQDN 2 395 + #define SADB_IDENTTYPE_USERFQDN 3 396 + #define SADB_X_IDENTTYPE_ADDR 4 397 + #define SADB_IDENTTYPE_MAX 4 398 + 399 + /* `flags' in sadb_sa structure holds followings */ 400 + #define SADB_X_EXT_NONE 0x0000 /* i.e. new format. */ 401 + #define SADB_X_EXT_OLD 0x0001 /* old format. */ 402 + 403 + #define SADB_X_EXT_IV4B 0x0010 /* IV length of 4 bytes in use */ 404 + #define SADB_X_EXT_DERIV 0x0020 /* DES derived */ 405 + #define SADB_X_EXT_CYCSEQ 0x0040 /* allowing to cyclic sequence. */ 406 + 407 + /* three of followings are exclusive flags each them */ 408 + #define SADB_X_EXT_PSEQ 0x0000 /* sequencial padding for ESP */ 409 + #define SADB_X_EXT_PRAND 0x0100 /* random padding for ESP */ 410 + #define SADB_X_EXT_PZERO 0x0200 /* zero padding for ESP */ 411 + #define SADB_X_EXT_PMASK 0x0300 /* mask for padding flag */ 412 + 413 + 414 + #if 1 415 + #define SADB_X_EXT_RAWCPI 0x0080 /* use well known CPI (IPComp) */ 416 + #endif 417 + 418 + #define SADB_KEY_FLAGS_MAX 0x0fff 419 + 420 + /* SPI size for PF_KEYv2 */ 421 + #define PFKEY_SPI_SIZE sizeof(u_int32_t) 422 + 423 + /* Identifier for menber of lifetime structure */ 424 + #define SADB_X_LIFETIME_ALLOCATIONS 0 425 + #define SADB_X_LIFETIME_BYTES 1 426 + #define SADB_X_LIFETIME_ADDTIME 2 427 + #define SADB_X_LIFETIME_USETIME 3 428 + 429 + /* The rate for SOFT lifetime against HARD one. */ 430 + #define PFKEY_SOFT_LIFETIME_RATE 80 431 + 432 + /* Utilities */ 433 + #define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) 434 + #define PFKEY_EXTLEN(msg) \ 435 + PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len) 436 + #define PFKEY_ADDR_PREFIX(ext) \ 437 + (((struct sadb_address *)(ext))->sadb_address_prefixlen) 438 + #define PFKEY_ADDR_PROTO(ext) \ 439 + (((struct sadb_address *)(ext))->sadb_address_proto) 440 + #define PFKEY_ADDR_SADDR(ext) \ 441 + ((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address))) 442 + 443 + /* in 64bits */ 444 + #define PFKEY_UNUNIT64(a) ((a) << 3) 445 + #define PFKEY_UNIT64(a) ((a) >> 3) 446 + 447 + #endif /* __PFKEY_V2_H */ 448 + 449 + #endif /* _NET_PFKEYV2_H_ */
+273
platform-include/net/route.h
··· 1 + /* 2 + * Copyright (c) 2000-2012 Apple Inc. All rights reserved. 3 + * 4 + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 + * 6 + * This file contains Original Code and/or Modifications of Original Code 7 + * as defined in and that are subject to the Apple Public Source License 8 + * Version 2.0 (the 'License'). You may not use this file except in 9 + * compliance with the License. The rights granted to you under the License 10 + * may not be used to create, or enable the creation or redistribution of, 11 + * unlawful or unlicensed copies of an Apple operating system, or to 12 + * circumvent, violate, or enable the circumvention or violation of, any 13 + * terms of an Apple operating system software license agreement. 14 + * 15 + * Please obtain a copy of the License at 16 + * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 + * 18 + * The Original Code and all software distributed under the License are 19 + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 + * Please see the License for the specific language governing rights and 24 + * limitations under the License. 25 + * 26 + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 + */ 28 + /* 29 + * Copyright (c) 1980, 1986, 1993 30 + * The Regents of the University of California. All rights reserved. 31 + * 32 + * Redistribution and use in source and binary forms, with or without 33 + * modification, are permitted provided that the following conditions 34 + * are met: 35 + * 1. Redistributions of source code must retain the above copyright 36 + * notice, this list of conditions and the following disclaimer. 37 + * 2. Redistributions in binary form must reproduce the above copyright 38 + * notice, this list of conditions and the following disclaimer in the 39 + * documentation and/or other materials provided with the distribution. 40 + * 3. All advertising materials mentioning features or use of this software 41 + * must display the following acknowledgement: 42 + * This product includes software developed by the University of 43 + * California, Berkeley and its contributors. 44 + * 4. Neither the name of the University nor the names of its contributors 45 + * may be used to endorse or promote products derived from this software 46 + * without specific prior written permission. 47 + * 48 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 49 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 50 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 51 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 52 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 53 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 54 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 55 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 56 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 57 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 58 + * SUCH DAMAGE. 59 + * 60 + * @(#)route.h 8.3 (Berkeley) 4/19/94 61 + * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $ 62 + */ 63 + 64 + #ifndef _NET_ROUTE_H_ 65 + #define _NET_ROUTE_H_ 66 + #include <sys/appleapiopts.h> 67 + #include <stdint.h> 68 + #include <sys/types.h> 69 + #include <sys/socket.h> 70 + 71 + /* 72 + * Kernel resident routing tables. 73 + * 74 + * The routing tables are initialized when interface addresses 75 + * are set by making entries for all directly connected interfaces. 76 + */ 77 + 78 + /* 79 + * A route consists of a destination address and a reference 80 + * to a routing entry. These are often held by protocols 81 + * in their control blocks, e.g. inpcb. 82 + */ 83 + struct route; 84 + 85 + /* 86 + * These numbers are used by reliable protocols for determining 87 + * retransmission behavior and are included in the routing structure. 88 + */ 89 + struct rt_metrics { 90 + u_int32_t rmx_locks; /* Kernel must leave these values alone */ 91 + u_int32_t rmx_mtu; /* MTU for this path */ 92 + u_int32_t rmx_hopcount; /* max hops expected */ 93 + int32_t rmx_expire; /* lifetime for route, e.g. redirect */ 94 + u_int32_t rmx_recvpipe; /* inbound delay-bandwidth product */ 95 + u_int32_t rmx_sendpipe; /* outbound delay-bandwidth product */ 96 + u_int32_t rmx_ssthresh; /* outbound gateway buffer limit */ 97 + u_int32_t rmx_rtt; /* estimated round trip time */ 98 + u_int32_t rmx_rttvar; /* estimated rtt variance */ 99 + u_int32_t rmx_pksent; /* packets sent using this route */ 100 + u_int32_t rmx_filler[4]; /* will be used for T/TCP later */ 101 + }; 102 + 103 + /* 104 + * rmx_rtt and rmx_rttvar are stored as microseconds; 105 + */ 106 + #define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ 107 + 108 + 109 + /* 110 + * We distinguish between routes to hosts and routes to networks, 111 + * preferring the former if available. For each route we infer 112 + * the interface to use from the gateway address supplied when 113 + * the route was entered. Routes that forward packets through 114 + * gateways are marked so that the output routines know to address the 115 + * gateway rather than the ultimate destination. 116 + */ 117 + 118 + 119 + #define RTF_UP 0x1 /* route usable */ 120 + #define RTF_GATEWAY 0x2 /* destination is a gateway */ 121 + #define RTF_HOST 0x4 /* host entry (net otherwise) */ 122 + #define RTF_REJECT 0x8 /* host or net unreachable */ 123 + #define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ 124 + #define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ 125 + #define RTF_DONE 0x40 /* message confirmed */ 126 + #define RTF_DELCLONE 0x80 /* delete cloned route */ 127 + #define RTF_CLONING 0x100 /* generate new routes on use */ 128 + #define RTF_XRESOLVE 0x200 /* external daemon resolves name */ 129 + #define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ 130 + #define RTF_STATIC 0x800 /* manually added */ 131 + #define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ 132 + #define RTF_PROTO2 0x4000 /* protocol specific routing flag */ 133 + #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ 134 + 135 + #define RTF_PRCLONING 0x10000 /* protocol requires cloning */ 136 + #define RTF_WASCLONED 0x20000 /* route generated through cloning */ 137 + #define RTF_PROTO3 0x40000 /* protocol specific routing flag */ 138 + /* 0x80000 unused */ 139 + #define RTF_PINNED 0x100000 /* future use */ 140 + #define RTF_LOCAL 0x200000 /* route represents a local address */ 141 + #define RTF_BROADCAST 0x400000 /* route represents a bcast address */ 142 + #define RTF_MULTICAST 0x800000 /* route represents a mcast address */ 143 + #define RTF_IFSCOPE 0x1000000 /* has valid interface scope */ 144 + #define RTF_CONDEMNED 0x2000000 /* defunct; no longer modifiable */ 145 + #define RTF_IFREF 0x4000000 /* route holds a ref to interface */ 146 + #define RTF_PROXY 0x8000000 /* proxying, no interface scope */ 147 + #define RTF_ROUTER 0x10000000 /* host is a router */ 148 + /* 0x20000000 and up unassigned */ 149 + 150 + /* 151 + * Routing statistics. 152 + */ 153 + struct rtstat { 154 + short rts_badredirect; /* bogus redirect calls */ 155 + short rts_dynamic; /* routes created by redirects */ 156 + short rts_newgateway; /* routes modified by redirects */ 157 + short rts_unreach; /* lookups which failed */ 158 + short rts_wildcard; /* lookups satisfied by a wildcard */ 159 + }; 160 + 161 + /* 162 + * Structures for routing messages. 163 + */ 164 + struct rt_msghdr { 165 + u_short rtm_msglen; /* to skip over non-understood messages */ 166 + u_char rtm_version; /* future binary compatibility */ 167 + u_char rtm_type; /* message type */ 168 + u_short rtm_index; /* index for associated ifp */ 169 + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ 170 + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ 171 + pid_t rtm_pid; /* identify sender */ 172 + int rtm_seq; /* for sender to identify action */ 173 + int rtm_errno; /* why failed */ 174 + int rtm_use; /* from rtentry */ 175 + u_int32_t rtm_inits; /* which metrics we are initializing */ 176 + struct rt_metrics rtm_rmx; /* metrics themselves */ 177 + }; 178 + 179 + struct rt_msghdr2 { 180 + u_short rtm_msglen; /* to skip over non-understood messages */ 181 + u_char rtm_version; /* future binary compatibility */ 182 + u_char rtm_type; /* message type */ 183 + u_short rtm_index; /* index for associated ifp */ 184 + int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ 185 + int rtm_addrs; /* bitmask identifying sockaddrs in msg */ 186 + int32_t rtm_refcnt; /* reference count */ 187 + int rtm_parentflags; /* flags of the parent route */ 188 + int rtm_reserved; /* reserved field set to 0 */ 189 + int rtm_use; /* from rtentry */ 190 + u_int32_t rtm_inits; /* which metrics we are initializing */ 191 + struct rt_metrics rtm_rmx; /* metrics themselves */ 192 + }; 193 + 194 + 195 + #define RTM_VERSION 5 /* Up the ante and ignore older versions */ 196 + 197 + /* 198 + * Message types. 199 + */ 200 + #define RTM_ADD 0x1 /* Add Route */ 201 + #define RTM_DELETE 0x2 /* Delete Route */ 202 + #define RTM_CHANGE 0x3 /* Change Metrics or flags */ 203 + #define RTM_GET 0x4 /* Report Metrics */ 204 + #define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ 205 + #define RTM_REDIRECT 0x6 /* Told to use different route */ 206 + #define RTM_MISS 0x7 /* Lookup failed on this address */ 207 + #define RTM_LOCK 0x8 /* fix specified metrics */ 208 + #define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ 209 + #define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ 210 + #define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ 211 + #define RTM_NEWADDR 0xc /* address being added to iface */ 212 + #define RTM_DELADDR 0xd /* address being removed from iface */ 213 + #define RTM_IFINFO 0xe /* iface going up/down etc. */ 214 + #define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ 215 + #define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ 216 + #define RTM_IFINFO2 0x12 /* */ 217 + #define RTM_NEWMADDR2 0x13 /* */ 218 + #define RTM_GET2 0x14 /* */ 219 + 220 + /* 221 + * Bitmask values for rtm_inits and rmx_locks. 222 + */ 223 + #define RTV_MTU 0x1 /* init or lock _mtu */ 224 + #define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ 225 + #define RTV_EXPIRE 0x4 /* init or lock _expire */ 226 + #define RTV_RPIPE 0x8 /* init or lock _recvpipe */ 227 + #define RTV_SPIPE 0x10 /* init or lock _sendpipe */ 228 + #define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ 229 + #define RTV_RTT 0x40 /* init or lock _rtt */ 230 + #define RTV_RTTVAR 0x80 /* init or lock _rttvar */ 231 + 232 + /* 233 + * Bitmask values for rtm_addrs. 234 + */ 235 + #define RTA_DST 0x1 /* destination sockaddr present */ 236 + #define RTA_GATEWAY 0x2 /* gateway sockaddr present */ 237 + #define RTA_NETMASK 0x4 /* netmask sockaddr present */ 238 + #define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ 239 + #define RTA_IFP 0x10 /* interface name sockaddr present */ 240 + #define RTA_IFA 0x20 /* interface addr sockaddr present */ 241 + #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ 242 + #define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ 243 + 244 + /* 245 + * Index offsets for sockaddr array for alternate internal encoding. 246 + */ 247 + #define RTAX_DST 0 /* destination sockaddr present */ 248 + #define RTAX_GATEWAY 1 /* gateway sockaddr present */ 249 + #define RTAX_NETMASK 2 /* netmask sockaddr present */ 250 + #define RTAX_GENMASK 3 /* cloning mask sockaddr present */ 251 + #define RTAX_IFP 4 /* interface name sockaddr present */ 252 + #define RTAX_IFA 5 /* interface addr sockaddr present */ 253 + #define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ 254 + #define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ 255 + #define RTAX_MAX 8 /* size of array to allocate */ 256 + 257 + struct rt_addrinfo { 258 + int rti_addrs; 259 + struct sockaddr *rti_info[RTAX_MAX]; 260 + }; 261 + 262 + struct route_cb { 263 + int ip_count; 264 + int ip6_count; 265 + int ipx_count; 266 + int ns_count; 267 + int iso_count; 268 + int any_count; 269 + }; 270 + 271 + 272 + 273 + #endif
+493
platform-include/resolv.h
··· 1 + /* 2 + * Copyright (c) 1983, 1987, 1989 3 + * The Regents of the University of California. All rights reserved. 4 + * 5 + * Redistribution and use in source and binary forms, with or without 6 + * modification, are permitted provided that the following conditions 7 + * are met: 8 + * 1. Redistributions of source code must retain the above copyright 9 + * notice, this list of conditions and the following disclaimer. 10 + * 2. Redistributions in binary form must reproduce the above copyright 11 + * notice, this list of conditions and the following disclaimer in the 12 + * documentation and/or other materials provided with the distribution. 13 + * 3. All advertising materials mentioning features or use of this software 14 + * must display the following acknowledgement: 15 + * This product includes software developed by the University of 16 + * California, Berkeley and its contributors. 17 + * 4. Neither the name of the University nor the names of its contributors 18 + * may be used to endorse or promote products derived from this software 19 + * without specific prior written permission. 20 + * 21 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 + * SUCH DAMAGE. 32 + */ 33 + 34 + /* 35 + * Portions Copyright (c) 1996-1999 by Internet Software Consortium. 36 + * 37 + * Permission to use, copy, modify, and distribute this software for any 38 + * purpose with or without fee is hereby granted, provided that the above 39 + * copyright notice and this permission notice appear in all copies. 40 + * 41 + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS 42 + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 43 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE 44 + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 45 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 46 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 47 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 48 + * SOFTWARE. 49 + */ 50 + 51 + /* 52 + * @(#)resolv.h 8.1 (Berkeley) 6/2/93 53 + * $Id: resolv.h,v 1.1 2006/03/01 19:01:39 majka Exp $ 54 + */ 55 + 56 + /* 57 + * Important note regarding the BIND-9 API on Mac OS 58 + * ------------------------------------------------- 59 + * 60 + * Mac OS supports a DNS query routing API (see <dns.h>) which is used by 61 + * most system services to access DNS. The BIND-9 APIs described here are 62 + * a lower-level that does not do query routing or search amongst multiple 63 + * resolver clients. The results of DNS queries from this API may differ 64 + * significantly from the results of queries sent to the <dns.h> API. We 65 + * strongly encourage developers to use higher-level APIs where possible. 66 + */ 67 + 68 + #ifndef _RESOLV_9_H_ 69 + #define _RESOLV_9_H_ 70 + 71 + #include <sys/param.h> 72 + #if (!defined(BSD)) || (BSD < 199306) 73 + # include <sys/bitypes.h> 74 + #else 75 + # include <sys/types.h> 76 + #endif 77 + #include <sys/cdefs.h> 78 + #include <sys/socket.h> 79 + #include <netinet/in.h> 80 + #include <stdio.h> 81 + #include <nameser.h> 82 + 83 + /* 84 + * Revision information. This is the release date in YYYYMMDD format. 85 + * It can change every day so the right thing to do with it is use it 86 + * in preprocessor commands such as "#if (__RES > 19931104)". Do not 87 + * compare for equality; rather, use it to determine whether your resolver 88 + * is new enough to contain a certain feature. 89 + */ 90 + 91 + #define __RES 19991006 92 + 93 + #define __h_errno_set _res_9_h_errno_set 94 + #define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x) 95 + 96 + #define __res_state __res_9_state 97 + struct __res_state; /* forward */ 98 + 99 + __BEGIN_DECLS 100 + void __h_errno_set(struct __res_state *res, int err); 101 + __END_DECLS 102 + 103 + /* 104 + * Resolver configuration file. 105 + * Normally not present, but may contain the address of the 106 + * inital name server(s) to query and the domain search list. 107 + * 108 + * Apple Note: The default DNS resolver client configuration 109 + * is now stored in a system configuration database, not in 110 + */ 111 + 112 + #ifndef _PATH_RESCONF 113 + #define _PATH_RESCONF "/etc/resolv.conf" 114 + #endif 115 + 116 + #define res_goahead res_9_goahead 117 + #define res_nextns res_9_nextns 118 + #define res_modified res_9_modified 119 + #define res_done res_9_done 120 + #define res_error res_9_error 121 + #define res_sendhookact res_9_sendhookact 122 + 123 + typedef enum 124 + { 125 + res_goahead, 126 + res_nextns, 127 + res_modified, 128 + res_done, 129 + res_error 130 + } res_sendhookact; 131 + 132 + typedef res_sendhookact (*res_send_qhook)__P((struct sockaddr * const *ns, 133 + const u_char **query, 134 + int *querylen, 135 + u_char *ans, 136 + int anssiz, 137 + int *resplen)); 138 + 139 + typedef res_sendhookact (*res_send_rhook)__P((const struct sockaddr *ns, 140 + const u_char *query, 141 + int querylen, 142 + u_char *ans, 143 + int anssiz, 144 + int *resplen)); 145 + 146 + #define res_sym res_9_sym 147 + 148 + struct res_sym 149 + { 150 + int number; /* Identifying number, like T_MX */ 151 + const char * name; /* Its symbolic name, like "MX" */ 152 + const char * humanname; /* Its fun name, like "mail exchanger" */ 153 + }; 154 + 155 + /* 156 + * Global defines and variables for resolver stub. 157 + */ 158 + #define MAXNS 3 /* max # name servers we'll track */ 159 + #define MAXDFLSRCH 3 /* # default domain levels to try */ 160 + #define MAXDNSRCH 6 /* max # domains in search path */ 161 + #define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ 162 + 163 + #define RES_TIMEOUT 5 /* min. seconds between retries */ 164 + #define MAXRESOLVSORT 10 /* number of net to sort on */ 165 + #define RES_MAXNDOTS 15 /* should reflect bit field size */ 166 + #define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ 167 + #define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ 168 + #define RES_DFLRETRY 2 /* Default #/tries. */ 169 + #define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ 170 + 171 + #define __res_state_ext __res_9_state_ext 172 + struct __res_state_ext; 173 + 174 + #define __res_state __res_9_state 175 + struct __res_state { 176 + int retrans; /* retransmition time interval */ 177 + int retry; /* number of times to transmit (attempts, not retries) */ 178 + #ifdef sun 179 + u_int options; /* option flags - see below. */ 180 + #else 181 + u_long options; /* option flags - see below. */ 182 + #endif 183 + int nscount; /* number of name servers */ 184 + struct sockaddr_in 185 + nsaddr_list[MAXNS]; /* address of name server */ 186 + #define nsaddr nsaddr_list[0] /* for backward compatibility */ 187 + u_short id; /* current message id */ 188 + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ 189 + char defdname[256]; /* default domain (deprecated) */ 190 + #ifdef sun 191 + u_int pfcode; /* RES_PRF_ flags - see below. */ 192 + #else 193 + u_long pfcode; /* RES_PRF_ flags - see below. */ 194 + #endif 195 + unsigned ndots:4; /* threshold for initial abs. query */ 196 + unsigned nsort:4; /* number of elements in sort_list[] */ 197 + char unused[3]; 198 + struct { 199 + struct in_addr addr; 200 + u_int32_t mask; 201 + } sort_list[MAXRESOLVSORT]; 202 + res_send_qhook qhook; /* query hook */ 203 + res_send_rhook rhook; /* response hook */ 204 + int res_h_errno; /* last one set for this context */ 205 + int _vcsock; /* PRIVATE: for res_send VC i/o */ 206 + u_int _flags; /* PRIVATE: see below */ 207 + u_int _pad; /* make _u 64 bit aligned */ 208 + union { 209 + /* On an 32-bit arch this means 512b total. */ 210 + char pad[72 - 4*sizeof (int) - 2*sizeof (void *)]; 211 + struct { 212 + u_int16_t nscount; 213 + u_int16_t nstimes[MAXNS]; /* ms. */ 214 + int nssocks[MAXNS]; 215 + struct __res_state_ext *ext; /* extention for IPv6 */ 216 + } _ext; 217 + } _u; 218 + }; 219 + 220 + #define res_state res_9_state 221 + 222 + typedef struct __res_state *res_state; 223 + 224 + #define res_sockaddr_union res_9_sockaddr_union 225 + 226 + union res_sockaddr_union { 227 + struct sockaddr_in sin; 228 + #ifdef IN6ADDR_ANY_INIT 229 + struct sockaddr_in6 sin6; 230 + #endif 231 + #ifdef ISC_ALIGN64 232 + int64_t __align64; /* 64bit alignment */ 233 + #else 234 + int32_t __align32; /* 32bit alignment */ 235 + #endif 236 + char __space[128]; /* max size */ 237 + }; 238 + 239 + /* 240 + * Resolver flags (used to be discrete per-module statics ints). 241 + */ 242 + #define RES_F_VC 0x00000001 /* socket is TCP */ 243 + #define RES_F_CONN 0x00000002 /* socket is connected */ 244 + #define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors */ 245 + 246 + /* res_findzonecut2() options */ 247 + #define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ 248 + #define RES_IPV4ONLY 0x00000002 /* IPv4 only */ 249 + #define RES_IPV6ONLY 0x00000004 /* IPv6 only */ 250 + 251 + /* 252 + * Resolver options (keep these in synch with res_debug.c, please) 253 + */ 254 + #define RES_INIT 0x00000001 /* address initialized */ 255 + #define RES_DEBUG 0x00000002 /* print debug messages */ 256 + #define RES_AAONLY 0x00000004 /* authoritative answers only (!IMPL)*/ 257 + #define RES_USEVC 0x00000008 /* use virtual circuit */ 258 + #define RES_PRIMARY 0x00000010 /* query primary server only (!IMPL) */ 259 + #define RES_IGNTC 0x00000020 /* ignore trucation errors */ 260 + #define RES_RECURSE 0x00000040 /* recursion desired */ 261 + #define RES_DEFNAMES 0x00000080 /* use default domain name */ 262 + #define RES_STAYOPEN 0x00000100 /* Keep TCP socket open */ 263 + #define RES_DNSRCH 0x00000200 /* search up local domain tree */ 264 + #define RES_INSECURE1 0x00000400 /* type 1 security disabled */ 265 + #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ 266 + #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ 267 + #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ 268 + #define RES_ROTATE 0x00004000 /* rotate ns list after each query */ 269 + #define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ 270 + #define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ 271 + #define RES_BLAST 0x00020000 /* blast all recursive servers */ 272 + #define RES_NO_NIBBLE 0x00040000 /* disable IPv6 nibble mode reverse */ 273 + #define RES_NO_BITSTRING 0x00080000 /* disable IPv6 bitstring mode reverse */ 274 + #define RES_NOTLDQUERY 0x00100000 /* don't unqualified name as a tld */ 275 + #define RES_USE_DNSSEC 0x00200000 /* use DNSSEC using OK bit in OPT */ 276 + /* KAME extensions: use higher bit to avoid conflict with ISC use */ 277 + #define RES_USE_DNAME 0x10000000 /* use DNAME */ 278 + #define RES_USE_A6 0x20000000 /* use A6 */ 279 + #define RES_USE_EDNS0 0x40000000 /* use EDNS0 if configured */ 280 + #define RES_NO_NIBBLE2 0x80000000 /* disable alternate nibble lookup */ 281 + 282 + #define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH | RES_INSECURE1) 283 + 284 + /* 285 + * Resolver "pfcode" values. Used by dig. 286 + */ 287 + #define RES_PRF_STATS 0x00000001 288 + #define RES_PRF_UPDATE 0x00000002 289 + #define RES_PRF_CLASS 0x00000004 290 + #define RES_PRF_CMD 0x00000008 291 + #define RES_PRF_QUES 0x00000010 292 + #define RES_PRF_ANS 0x00000020 293 + #define RES_PRF_AUTH 0x00000040 294 + #define RES_PRF_ADD 0x00000080 295 + #define RES_PRF_HEAD1 0x00000100 296 + #define RES_PRF_HEAD2 0x00000200 297 + #define RES_PRF_TTLID 0x00000400 298 + #define RES_PRF_HEADX 0x00000800 299 + #define RES_PRF_QUERY 0x00001000 300 + #define RES_PRF_REPLY 0x00002000 301 + #define RES_PRF_INIT 0x00004000 302 + #define RES_PRF_TRUNC 0x00008000 303 + /* 0x00010000 */ 304 + 305 + /* Things involving an internal (static) resolver context. */ 306 + #ifndef __BIND_NOSTATIC 307 + extern struct __res_state _res; 308 + #endif 309 + 310 + #ifndef __BIND_NOSTATIC 311 + #define fp_nquery res_9_fp_nquery 312 + #define fp_query res_9_fp_query 313 + #define hostalias res_9_hostalias_1 314 + #define p_query res_9_p_query 315 + #define res_close res_9_close 316 + #define res_init res_9_init 317 + #define res_isourserver res_9_isourserver 318 + #define res_mkquery res_9_mkquery 319 + #define res_query res_9_query 320 + #define res_querydomain res_9_querydomain 321 + #define res_search res_9_search 322 + #define res_send res_9_send 323 + #define res_sendsigned res_9_sendsigned 324 + 325 + __BEGIN_DECLS 326 + void fp_nquery __P((const u_char *, int, FILE *)); 327 + void fp_query __P((const u_char *, FILE *)); 328 + const char *hostalias __P((const char *)); 329 + void p_query __P((const u_char *)); 330 + void res_close __P((void)); 331 + int res_init __P((void)); 332 + int res_isourserver __P((const struct sockaddr_in *)); 333 + int res_mkquery __P((int, const char *, int, int, const u_char *, 334 + int, const u_char *, u_char *, int)); 335 + int res_query __P((const char *, int, int, u_char *, int)); 336 + int res_querydomain __P((const char *, const char *, int, int, 337 + u_char *, int)); 338 + int res_search __P((const char *, int, int, u_char *, int)); 339 + int res_send __P((const u_char *, int, u_char *, int)); 340 + int res_sendsigned __P((const u_char *, int, ns_tsig_key *, 341 + u_char *, int)); 342 + __END_DECLS 343 + #endif 344 + 345 + #if !defined(SHARED_LIBBIND) || defined(LIB) 346 + /* 347 + * If libbind is a shared object (well, DLL anyway) 348 + * these externs break the linker when resolv.h is 349 + * included by a lib client (like named) 350 + * Make them go away if a client is including this 351 + * 352 + */ 353 + #define res_sym res_9_sym 354 + #define __p_key_syms __res_9_p_key_syms 355 + #define __p_cert_syms __res_9_p_cert_syms 356 + #define __p_class_syms __res_9_p_class_syms 357 + #define __p_type_syms __res_9_p_type_syms 358 + #define __p_rcode_syms __res_9_p_rcode_syms 359 + 360 + extern const struct res_sym __p_key_syms[]; 361 + extern const struct res_sym __p_cert_syms[]; 362 + extern const struct res_sym __p_class_syms[]; 363 + extern const struct res_sym __p_type_syms[]; 364 + extern const struct res_sym __p_rcode_syms[]; 365 + #endif /* SHARED_LIBBIND */ 366 + 367 + #define b64_ntop res_9_b64_ntop 368 + #define b64_pton res_9_b64_pton 369 + #define dn_comp res_9_dn_comp 370 + #define dn_count_labels res_9_dn_count_labels 371 + #define dn_expand res_9_dn_expand 372 + #define dn_skipname res_9_dn_skipname 373 + #define fp_resstat res_9_fp_resstat 374 + #define loc_aton res_9_loc_aton 375 + #define loc_ntoa res_9_loc_ntoa 376 + #define p_cdname res_9_p_cdname 377 + #define p_cdnname res_9_p_cdnname 378 + #define p_class res_9_p_class 379 + #define p_fqname res_9_p_fqname 380 + #define p_fqnname res_9_p_fqnname 381 + #define p_option res_9_p_option 382 + #define p_secstodate res_9_p_secstodate 383 + #define p_section res_9_p_section 384 + #define p_time res_9_p_time 385 + #define p_type res_9_p_type 386 + #define p_rcode res_9_p_rcode 387 + #define putlong res_9_putlong 388 + #define putshort res_9_putshort 389 + #define res_dnok res_9_dnok 390 + #define res_findzonecut res_9_findzonecut 391 + #define res_findzonecut2 res_9_findzonecut2 392 + #define res_hnok res_9_hnok 393 + #define res_hostalias res_9_hostalias_2 394 + #define res_mailok res_9_mailok 395 + #define res_nameinquery res_9_nameinquery 396 + #define res_nclose res_9_nclose 397 + #define res_ninit res_9_ninit 398 + #define res_nmkquery res_9_nmkquery 399 + #define res_pquery res_9_pquery 400 + #define res_nquery res_9_nquery 401 + #define res_nquerydomain res_9_nquerydomain 402 + #define res_nsearch res_9_nsearch 403 + #define res_nsend res_9_nsend 404 + #define res_nsendsigned res_9_nsendsigned 405 + #define res_nisourserver res_9_nisourserver 406 + #define res_ownok res_9_ownok 407 + #define res_queriesmatch res_9_queriesmatch 408 + #define res_randomid res_9_randomid 409 + #define sym_ntop res_9_sym_ntop 410 + #define sym_ntos res_9_sym_ntos 411 + #define sym_ston res_9_sym_ston 412 + #define res_nopt res_9_nopt 413 + #define res_ndestroy res_9_ndestroy 414 + #define res_nametoclass res_9_nametoclass 415 + #define res_nametotype res_9_nametotype 416 + #define res_setservers res_9_setservers 417 + #define res_getservers res_9_getservers 418 + #define _getshort res_9_getshort 419 + #define _getlong res_9_getlong 420 + #define __res_vinit res_9_vinit 421 + 422 + __BEGIN_DECLS 423 + int res_hnok __P((const char *)); 424 + int res_ownok __P((const char *)); 425 + int res_mailok __P((const char *)); 426 + int res_dnok __P((const char *)); 427 + int sym_ston __P((const struct res_sym *, const char *, int *)); 428 + const char * sym_ntos __P((const struct res_sym *, int, int *)); 429 + const char *sym_ntop __P((const struct res_sym *, int, int *)); 430 + int b64_ntop __P((u_char const *, size_t, char *, size_t)); 431 + int b64_pton __P((char const *, u_char *, size_t)); 432 + int loc_aton __P((const char *ascii, u_char *binary)); 433 + const char * loc_ntoa __P((const u_char *binary, char *ascii)); 434 + int dn_skipname __P((const u_char *, const u_char *)); 435 + void putlong __P((u_int32_t, u_char *)); 436 + void putshort __P((u_int16_t, u_char *)); 437 + #ifndef __ultrix__ 438 + u_int16_t _getshort __P((const u_char *src)); 439 + u_int32_t _getlong __P((const u_char *src)); 440 + #endif 441 + const char * p_class __P((int)); 442 + const char * p_time __P((u_int32_t)); 443 + const char * p_type __P((int)); 444 + const char * p_rcode __P((int)); 445 + const u_char * p_cdnname __P((const u_char *, const u_char *, int, FILE *)); 446 + const u_char * p_cdname __P((const u_char *, const u_char *, FILE *)); 447 + const u_char * p_fqnname __P((const u_char *cp, const u_char *msg, int, char *, int)); 448 + const u_char * p_fqname __P((const u_char *, const u_char *, FILE *)); 449 + const char * p_option __P((u_long option)); 450 + char * p_secstodate __P((u_long)); 451 + int dn_count_labels __P((const char *)); 452 + int dn_comp __P((const char *, u_char *, int, u_char **, u_char **)); 453 + int dn_expand __P((const u_char *, const u_char *, const u_char *, char *, int)); 454 + u_int res_randomid __P((void)); 455 + int res_nameinquery __P((const char *, int, int, const u_char *, const u_char *)); 456 + int res_queriesmatch __P((const u_char *, const u_char *, const u_char *, const u_char *)); 457 + const char * p_section __P((int section, int opcode)); 458 + 459 + /* Things involving a resolver context. */ 460 + int res_ninit __P((res_state)); 461 + int res_nisourserver __P((const res_state, const struct sockaddr_in *)); 462 + void fp_resstat __P((const res_state, FILE *)); 463 + void res_pquery __P((const res_state, const u_char *, int, FILE *)); 464 + const char *res_hostalias __P((const res_state, const char *, char *, size_t)); 465 + int res_nquery __P((res_state, const char *, int, int, u_char *, int)); 466 + int res_nsearch __P((res_state, const char *, int, int, u_char *, int)); 467 + int res_nquerydomain __P((res_state, const char *, const char *, int, int, u_char *, int)); 468 + int res_nmkquery __P((res_state, int, const char *, int, int, const u_char *, int, const u_char *, u_char *, int)); 469 + int res_nsend __P((res_state, const u_char *, int, u_char *, int)); 470 + int res_nsendsigned __P((res_state, const u_char *, int, ns_tsig_key *, u_char *, int)); 471 + int res_findzonecut __P((res_state, const char *, ns_class, int, char *, size_t, struct in_addr *, int)); 472 + int res_findzonecut2 __P((res_state, const char *, ns_class, int, char *, size_t, union res_sockaddr_union *, int)); 473 + void res_nclose __P((res_state)); 474 + int res_nopt __P((res_state, int, u_char *, int, int)); 475 + void res_send_setqhook __P((res_send_qhook hook)); 476 + void res_send_setrhook __P((res_send_rhook hook)); 477 + int __res_vinit __P((res_state, int)); 478 + void res_destroyservicelist __P((void)); 479 + const char * res_servicename __P((u_int16_t port, const char *proto)); 480 + const char * res_protocolname __P((int num)); 481 + void res_destroyprotolist __P((void)); 482 + void res_buildprotolist __P((void)); 483 + const char * res_get_nibblesuffix __P((res_state)); 484 + const char * res_get_nibblesuffix2 __P((res_state)); 485 + const char * res_get_bitstringsuffix __P((res_state)); 486 + void res_ndestroy __P((res_state)); 487 + u_int16_t res_nametoclass __P((const char *buf, int *success)); 488 + u_int16_t res_nametotype __P((const char *buf, int *success)); 489 + void res_setservers __P((res_state, const union res_sockaddr_union *, int)); 490 + int res_getservers __P((res_state, union res_sockaddr_union *, int)); 491 + __END_DECLS 492 + 493 + #endif /* !_RESOLV_9_H_ */