xref: /xnu-10002.1.13/bsd/net/net_kev.h (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
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_PRIMARY_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_DL_MASTER_ELECTED KEV_DL_PRIMARY_ELECTED
88 #else
89 #define KEV_DL_MASTER_ELECTED (_Pragma("gcc warn Use KEV_DL_PRIMARY_ELECTED instead") KEV_DL_PRIMARY_ELECTED)
90 #endif /* PRIVATE */
91 
92 #ifdef PRIVATE
93 #define KEV_NETPOLICY_SUBCLASS  3       /* Network policy subclass */
94 /* KEV_NETPOLICY_SUBCLASS event codes */
95 #define KEV_NETPOLICY_IFDENIED  1       /* denied access to interface */
96 #define KEV_NETPOLICY_IFFAILED  2       /* failed to bring up interface */
97 #define KEV_NETPOLICY_NETDENIED 3       /* denied access to some network */
98 
99 #define NETPOLICY_NETWORKTYPE_LOCAL     1   /* local network */
100 
101 
102 #define KEV_SOCKET_SUBCLASS     4       /* Socket subclass */
103 /* KEV_SOCKET_SUBCLASS event codes */
104 #define KEV_SOCKET_CLOSED       1       /* completely closed by protocol */
105 #endif /* PRIVATE */
106 
107 #define KEV_INET6_SUBCLASS      6       /* inet6 subclass */
108 /* KEV_INET6_SUBCLASS event codes */
109 #define KEV_INET6_NEW_USER_ADDR         1 /* Userland configured IPv6 address */
110 #define KEV_INET6_CHANGED_ADDR          2 /* Address changed event (future) */
111 #define KEV_INET6_ADDR_DELETED          3 /* IPv6 address was deleted */
112 #define KEV_INET6_NEW_LL_ADDR           4 /* Autoconf LL address appeared */
113 #define KEV_INET6_NEW_RTADV_ADDR        5 /* Autoconf address has appeared */
114 #define KEV_INET6_DEFROUTER             6 /* Default router detected */
115 #define KEV_INET6_REQUEST_NAT64_PREFIX  7 /* Asking for the NAT64-prefix */
116 
117 #ifdef PRIVATE
118 #define KEV_ND6_SUBCLASS        7       /* IPv6 NDP subclass */
119 /* KEV_ND6_SUBCLASS event codes */
120 #define KEV_ND6_RA                      1
121 #define KEV_ND6_NDFAILURE               2 /* IPv6 neighbor cache entry expiry */
122 #define KEV_ND6_NDALIVE                 3 /* IPv6 neighbor reachable */
123 #define KEV_ND6_DAD_FAILURE             4 /* IPv6 address failed DAD */
124 #define KEV_ND6_DAD_SUCCESS             5 /* IPv6 address completed DAD */
125 #define KEV_ND6_ADDR_DETACHED           6 /* IPv6 address is deemed detached */
126 #define KEV_ND6_ADDR_DEPRECATED         7 /* IPv6 address's preferred lifetime expired */
127 #define KEV_ND6_ADDR_EXPIRED            8 /* IPv6 address has expired */
128 #define KEV_ND6_RTR_EXPIRED             9 /* IPv6 default router has expired */
129 #define KEV_ND6_PFX_EXPIRED             10 /* IPv6 prefix has expired */
130 
131 #define KEV_NECP_SUBCLASS       8       /* NECP subclasss */
132 /* KEV_NECP_SUBCLASS event codes */
133 #define KEV_NECP_POLICIES_CHANGED 1
134 
135 #define KEV_NETAGENT_SUBCLASS   9       /* Net-Agent subclass */
136 /* Network Agent kernel event codes */
137 #define KEV_NETAGENT_REGISTERED                 1
138 #define KEV_NETAGENT_UNREGISTERED               2
139 #define KEV_NETAGENT_UPDATED                    3
140 #define KEV_NETAGENT_UPDATED_INTERFACES         4
141 
142 #define KEV_LOG_SUBCLASS        10      /* Log subclass */
143 /* KEV_LOG_SUBCLASS event codes */
144 #define IPFWLOGEVENT    0
145 
146 #define KEV_NETEVENT_SUBCLASS   11      /* Generic Net events subclass */
147 /* KEV_NETEVENT_SUBCLASS event codes */
148 #define KEV_NETEVENT_APNFALLBACK                1
149 #define KEV_NETEVENT_CLAT46_EVENT               2
150 
151 #define KEV_MPTCP_SUBCLASS      12      /* Global MPTCP events subclass */
152 /* KEV_MPTCP_SUBCLASS event codes */
153 #define KEV_MPTCP_CELLUSE       1
154 
155 #define KEV_IPSEC_SUBCLASS      13      /* IPsec event subclass */
156 #define KEV_IPSEC_WAKE_PACKET   1       /* IPsec wake packet available, the
157 	                                 * first packet processed after a wake event */
158 
159 #define KEV_POWER_SUBCLASS              14
160 #define KEV_POWER_WAKE_PACKET           1
161 #define KEV_POWER_UNATTRIBUTED_WAKE     2
162 
163 #endif /* PRIVATE */
164 #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
165 #endif /* _NET_NETKEV_H_ */
166