1/*
2 * Copyright (c) 2016-2018 Apple Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _NET_NETKEV_H_
30#define _NET_NETKEV_H_
31
32#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
33
34/* Kernel event subclass identifiers for KEV_NETWORK_CLASS */
35#define KEV_INET_SUBCLASS 1 /* inet subclass */
36/* KEV_INET_SUBCLASS event codes */
37#define KEV_INET_NEW_ADDR 1 /* Userland configured IP address */
38#define KEV_INET_CHANGED_ADDR 2 /* Address changed event */
39#define KEV_INET_ADDR_DELETED 3 /* IPv6 address was deleted */
40#define KEV_INET_SIFDSTADDR 4 /* Dest. address was set */
41#define KEV_INET_SIFBRDADDR 5 /* Broadcast address was set */
42#define KEV_INET_SIFNETMASK 6 /* Netmask was set */
43#define KEV_INET_ARPCOLLISION 7 /* ARP collision detected */
44#ifdef __APPLE_API_PRIVATE
45#define KEV_INET_PORTINUSE 8 /* use ken_in_portinuse */
46#endif
47#define KEV_INET_ARPRTRFAILURE 9 /* ARP resolution failed for router */
48#define KEV_INET_ARPRTRALIVE 10 /* ARP resolution succeeded for router */
49
50#define KEV_DL_SUBCLASS 2 /* Data Link subclass */
51/*
52 * Define Data-Link event subclass, and associated
53 * events.
54 */
55#define KEV_DL_SIFFLAGS 1
56#define KEV_DL_SIFMETRICS 2
57#define KEV_DL_SIFMTU 3
58#define KEV_DL_SIFPHYS 4
59#define KEV_DL_SIFMEDIA 5
60#define KEV_DL_SIFGENERIC 6
61#define KEV_DL_ADDMULTI 7
62#define KEV_DL_DELMULTI 8
63#define KEV_DL_IF_ATTACHED 9
64#define KEV_DL_IF_DETACHING 10
65#define KEV_DL_IF_DETACHED 11
66#define KEV_DL_LINK_OFF 12
67#define KEV_DL_LINK_ON 13
68#define KEV_DL_PROTO_ATTACHED 14
69#define KEV_DL_PROTO_DETACHED 15
70#define KEV_DL_LINK_ADDRESS_CHANGED 16
71#define KEV_DL_WAKEFLAGS_CHANGED 17
72#define KEV_DL_IF_IDLE_ROUTE_REFCNT 18
73#define KEV_DL_IFCAP_CHANGED 19
74#define KEV_DL_LINK_QUALITY_METRIC_CHANGED 20
75#define KEV_DL_NODE_PRESENCE 21
76#define KEV_DL_NODE_ABSENCE 22
77#define KEV_DL_MASTER_ELECTED 23
78#define KEV_DL_ISSUES 24
79#define KEV_DL_IFDELEGATE_CHANGED 25
80#define KEV_DL_AWDL_RESTRICTED 26
81#define KEV_DL_AWDL_UNRESTRICTED 27
82#define KEV_DL_RRC_STATE_CHANGED 28
83#define KEV_DL_QOS_MODE_CHANGED 29
84#define KEV_DL_LOW_POWER_MODE_CHANGED 30
85
86#ifdef PRIVATE
87#define KEV_NETPOLICY_SUBCLASS 3 /* Network policy subclass */
88/* KEV_NETPOLICY_SUBCLASS event codes */
89#define KEV_NETPOLICY_IFDENIED 1 /* denied access to interface */
90#define KEV_NETPOLICY_IFFAILED 2 /* failed to bring up interface */
91
92#define KEV_SOCKET_SUBCLASS 4 /* Socket subclass */
93/* KEV_SOCKET_SUBCLASS event codes */
94#define KEV_SOCKET_CLOSED 1 /* completely closed by protocol */
95#endif /* PRIVATE */
96
97#define KEV_INET6_SUBCLASS 6 /* inet6 subclass */
98/* KEV_INET6_SUBCLASS event codes */
99#define KEV_INET6_NEW_USER_ADDR 1 /* Userland configured IPv6 address */
100#define KEV_INET6_CHANGED_ADDR 2 /* Address changed event (future) */
101#define KEV_INET6_ADDR_DELETED 3 /* IPv6 address was deleted */
102#define KEV_INET6_NEW_LL_ADDR 4 /* Autoconf LL address appeared */
103#define KEV_INET6_NEW_RTADV_ADDR 5 /* Autoconf address has appeared */
104#define KEV_INET6_DEFROUTER 6 /* Default router detected */
105#define KEV_INET6_REQUEST_NAT64_PREFIX 7 /* Asking for the NAT64-prefix */
106
107#ifdef PRIVATE
108#define KEV_ND6_SUBCLASS 7 /* IPv6 NDP subclass */
109/* KEV_ND6_SUBCLASS event codes */
110#define KEV_ND6_RA 1
111#define KEV_ND6_NDFAILURE 2 /* IPv6 neighbor cache entry expiry */
112#define KEV_ND6_NDALIVE 3 /* IPv6 neighbor reachable */
113#define KEV_ND6_DAD_FAILURE 4 /* IPv6 address failed DAD */
114#define KEV_ND6_DAD_SUCCESS 5 /* IPv6 address completed DAD */
115#define KEV_ND6_ADDR_DETACHED 6 /* IPv6 address is deemed detached */
116#define KEV_ND6_ADDR_DEPRECATED 7 /* IPv6 address's preferred lifetime expired */
117#define KEV_ND6_ADDR_EXPIRED 8 /* IPv6 address has expired */
118#define KEV_ND6_RTR_EXPIRED 9 /* IPv6 default router has expired */
119#define KEV_ND6_PFX_EXPIRED 10 /* IPv6 prefix has expired */
120
121#define KEV_NECP_SUBCLASS 8 /* NECP subclasss */
122/* KEV_NECP_SUBCLASS event codes */
123#define KEV_NECP_POLICIES_CHANGED 1
124
125#define KEV_NETAGENT_SUBCLASS 9 /* Net-Agent subclass */
126/* Network Agent kernel event codes */
127#define KEV_NETAGENT_REGISTERED 1
128#define KEV_NETAGENT_UNREGISTERED 2
129#define KEV_NETAGENT_UPDATED 3
130#define KEV_NETAGENT_UPDATED_INTERFACES 4
131
132#define KEV_LOG_SUBCLASS 10 /* Log subclass */
133/* KEV_LOG_SUBCLASS event codes */
134#define IPFWLOGEVENT 0
135
136#define KEV_NETEVENT_SUBCLASS 11 /* Generic Net events subclass */
137/* KEV_NETEVENT_SUBCLASS event codes */
138#define KEV_NETEVENT_APNFALLBACK 1
139#define KEV_NETEVENT_CLAT46_EVENT 2
140
141#define KEV_MPTCP_SUBCLASS 12 /* Global MPTCP events subclass */
142/* KEV_MPTCP_SUBCLASS event codes */
143#define KEV_MPTCP_CELLUSE 1
144
145#endif /* PRIVATE */
146#endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
147#endif /* _NET_NETKEV_H_ */
148