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