Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
net_event.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_NET_NET_EVENT_H_
13#define ZEPHYR_INCLUDE_NET_NET_EVENT_H_
14
15#include <zephyr/net/net_ip.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
28/* Network Interface events */
29#define _NET_IF_LAYER NET_MGMT_LAYER_L2
30#define _NET_IF_CORE_CODE 0x001
31#define _NET_EVENT_IF_BASE (NET_MGMT_EVENT_BIT | \
32 NET_MGMT_IFACE_BIT | \
33 NET_MGMT_LAYER(_NET_IF_LAYER) | \
34 NET_MGMT_LAYER_CODE(_NET_IF_CORE_CODE))
35
36enum net_event_if_cmd {
37 NET_EVENT_IF_CMD_DOWN = 1,
38 NET_EVENT_IF_CMD_UP,
39 NET_EVENT_IF_CMD_ADMIN_DOWN,
40 NET_EVENT_IF_CMD_ADMIN_UP,
41
42};
43
44#define NET_EVENT_IF_DOWN \
45 (_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_DOWN)
46
47#define NET_EVENT_IF_UP \
48 (_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_UP)
49
50#define NET_EVENT_IF_ADMIN_DOWN \
51 (_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_ADMIN_DOWN)
52
53#define NET_EVENT_IF_ADMIN_UP \
54 (_NET_EVENT_IF_BASE | NET_EVENT_IF_CMD_ADMIN_UP)
55
56
57/* IPv6 Events */
58#define _NET_IPV6_LAYER NET_MGMT_LAYER_L3
59#define _NET_IPV6_CORE_CODE 0x060
60#define _NET_EVENT_IPV6_BASE (NET_MGMT_EVENT_BIT | \
61 NET_MGMT_IFACE_BIT | \
62 NET_MGMT_LAYER(_NET_IPV6_LAYER) | \
63 NET_MGMT_LAYER_CODE(_NET_IPV6_CORE_CODE))
64
65enum net_event_ipv6_cmd {
66 NET_EVENT_IPV6_CMD_ADDR_ADD = 1,
67 NET_EVENT_IPV6_CMD_ADDR_DEL,
68 NET_EVENT_IPV6_CMD_MADDR_ADD,
69 NET_EVENT_IPV6_CMD_MADDR_DEL,
70 NET_EVENT_IPV6_CMD_PREFIX_ADD,
71 NET_EVENT_IPV6_CMD_PREFIX_DEL,
72 NET_EVENT_IPV6_CMD_MCAST_JOIN,
73 NET_EVENT_IPV6_CMD_MCAST_LEAVE,
74 NET_EVENT_IPV6_CMD_ROUTER_ADD,
75 NET_EVENT_IPV6_CMD_ROUTER_DEL,
76 NET_EVENT_IPV6_CMD_ROUTE_ADD,
77 NET_EVENT_IPV6_CMD_ROUTE_DEL,
78 NET_EVENT_IPV6_CMD_DAD_SUCCEED,
79 NET_EVENT_IPV6_CMD_DAD_FAILED,
80 NET_EVENT_IPV6_CMD_NBR_ADD,
81 NET_EVENT_IPV6_CMD_NBR_DEL,
82 NET_EVENT_IPV6_CMD_DHCP_START,
83 NET_EVENT_IPV6_CMD_DHCP_BOUND,
84 NET_EVENT_IPV6_CMD_DHCP_STOP,
85};
86
87#define NET_EVENT_IPV6_ADDR_ADD \
88 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_ADD)
89
90#define NET_EVENT_IPV6_ADDR_DEL \
91 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ADDR_DEL)
92
93#define NET_EVENT_IPV6_MADDR_ADD \
94 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_ADD)
95
96#define NET_EVENT_IPV6_MADDR_DEL \
97 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MADDR_DEL)
98
99#define NET_EVENT_IPV6_PREFIX_ADD \
100 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_ADD)
101
102#define NET_EVENT_IPV6_PREFIX_DEL \
103 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_PREFIX_DEL)
104
105#define NET_EVENT_IPV6_MCAST_JOIN \
106 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_JOIN)
107
108#define NET_EVENT_IPV6_MCAST_LEAVE \
109 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_MCAST_LEAVE)
110
111#define NET_EVENT_IPV6_ROUTER_ADD \
112 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTER_ADD)
113
114#define NET_EVENT_IPV6_ROUTER_DEL \
115 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTER_DEL)
116
117#define NET_EVENT_IPV6_ROUTE_ADD \
118 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTE_ADD)
119
120#define NET_EVENT_IPV6_ROUTE_DEL \
121 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_ROUTE_DEL)
122
123#define NET_EVENT_IPV6_DAD_SUCCEED \
124 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DAD_SUCCEED)
125
126#define NET_EVENT_IPV6_DAD_FAILED \
127 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_DAD_FAILED)
128
129#define NET_EVENT_IPV6_NBR_ADD \
130 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_NBR_ADD)
131
132#define NET_EVENT_IPV6_NBR_DEL \
133 (_NET_EVENT_IPV6_BASE | NET_EVENT_IPV6_CMD_NBR_DEL)
134
135#define NET_EVENT_IPV6_DHCP_START \
136 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV6_CMD_DHCP_START)
137
138#define NET_EVENT_IPV6_DHCP_BOUND \
139 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV6_CMD_DHCP_BOUND)
140
141#define NET_EVENT_IPV6_DHCP_STOP \
142 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV6_CMD_DHCP_STOP)
143
144/* IPv4 Events*/
145#define _NET_IPV4_LAYER NET_MGMT_LAYER_L3
146#define _NET_IPV4_CORE_CODE 0x004
147#define _NET_EVENT_IPV4_BASE (NET_MGMT_EVENT_BIT | \
148 NET_MGMT_IFACE_BIT | \
149 NET_MGMT_LAYER(_NET_IPV4_LAYER) | \
150 NET_MGMT_LAYER_CODE(_NET_IPV4_CORE_CODE))
151
152enum net_event_ipv4_cmd {
153 NET_EVENT_IPV4_CMD_ADDR_ADD = 1,
154 NET_EVENT_IPV4_CMD_ADDR_DEL,
155 NET_EVENT_IPV4_CMD_MADDR_ADD,
156 NET_EVENT_IPV4_CMD_MADDR_DEL,
157 NET_EVENT_IPV4_CMD_ROUTER_ADD,
158 NET_EVENT_IPV4_CMD_ROUTER_DEL,
159 NET_EVENT_IPV4_CMD_DHCP_START,
160 NET_EVENT_IPV4_CMD_DHCP_BOUND,
161 NET_EVENT_IPV4_CMD_DHCP_STOP,
162 NET_EVENT_IPV4_CMD_MCAST_JOIN,
163 NET_EVENT_IPV4_CMD_MCAST_LEAVE,
164};
165
166#define NET_EVENT_IPV4_ADDR_ADD \
167 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_ADD)
168
169#define NET_EVENT_IPV4_ADDR_DEL \
170 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ADDR_DEL)
171
172#define NET_EVENT_IPV4_MADDR_ADD \
173 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_ADD)
174
175#define NET_EVENT_IPV4_MADDR_DEL \
176 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MADDR_DEL)
177
178#define NET_EVENT_IPV4_ROUTER_ADD \
179 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_ADD)
180
181#define NET_EVENT_IPV4_ROUTER_DEL \
182 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_ROUTER_DEL)
183
184#define NET_EVENT_IPV4_DHCP_START \
185 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_START)
186
187#define NET_EVENT_IPV4_DHCP_BOUND \
188 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_BOUND)
189
190#define NET_EVENT_IPV4_DHCP_STOP \
191 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_DHCP_STOP)
192
193#define NET_EVENT_IPV4_MCAST_JOIN \
194 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_JOIN)
195
196#define NET_EVENT_IPV4_MCAST_LEAVE \
197 (_NET_EVENT_IPV4_BASE | NET_EVENT_IPV4_CMD_MCAST_LEAVE)
198
199
200/* L4 network events */
201#define _NET_L4_LAYER NET_MGMT_LAYER_L4
202#define _NET_L4_CORE_CODE 0x114
203#define _NET_EVENT_L4_BASE (NET_MGMT_EVENT_BIT | \
204 NET_MGMT_IFACE_BIT | \
205 NET_MGMT_LAYER(_NET_L4_LAYER) | \
206 NET_MGMT_LAYER_CODE(_NET_L4_CORE_CODE))
207
208enum net_event_l4_cmd {
209 NET_EVENT_L4_CMD_CONNECTED = 1,
210 NET_EVENT_L4_CMD_DISCONNECTED,
211 NET_EVENT_L4_CMD_DNS_SERVER_ADD,
212 NET_EVENT_L4_CMD_DNS_SERVER_DEL,
213};
214
215#define NET_EVENT_L4_CONNECTED \
216 (_NET_EVENT_L4_BASE | NET_EVENT_L4_CMD_CONNECTED)
217
218#define NET_EVENT_L4_DISCONNECTED \
219 (_NET_EVENT_L4_BASE | NET_EVENT_L4_CMD_DISCONNECTED)
220
221#define NET_EVENT_DNS_SERVER_ADD \
222 (_NET_EVENT_L4_BASE | NET_EVENT_L4_CMD_DNS_SERVER_ADD)
223
224#define NET_EVENT_DNS_SERVER_DEL \
225 (_NET_EVENT_L4_BASE | NET_EVENT_L4_CMD_DNS_SERVER_DEL)
226
241};
242
254 int idx; /* NBR index*/
255};
256
267 struct in6_addr addr; /* addr/prefix */
269};
270
280 struct in6_addr addr; /* prefix */
283};
284
285#ifdef __cplusplus
286}
287#endif
288
293#endif /* ZEPHYR_INCLUDE_NET_NET_EVENT_H_ */
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
IPv6 address struct.
Definition: net_ip.h:139
Network Management event information structure Used to pass information on network events like NET_EV...
Definition: net_event.h:239
struct in6_addr addr
Definition: net_event.h:240
Network Management event information structure Used to pass information on network events like NET_EV...
Definition: net_event.h:252
struct in6_addr addr
Definition: net_event.h:253
int idx
Definition: net_event.h:254
Network Management event information structure Used to pass information on network events like NET_EV...
Definition: net_event.h:279
uint8_t len
Definition: net_event.h:281
struct in6_addr addr
Definition: net_event.h:280
uint32_t lifetime
Definition: net_event.h:282
Network Management event information structure Used to pass information on network events like NET_EV...
Definition: net_event.h:265
struct in6_addr addr
Definition: net_event.h:267
uint8_t prefix_len
Definition: net_event.h:268
struct in6_addr nexthop
Definition: net_event.h:266