12#ifndef ZEPHYR_INCLUDE_NET_NET_MGMT_H_
13#define ZEPHYR_INCLUDE_NET_NET_MGMT_H_
36#define NET_MGMT_EVENT_MASK 0x80000000
37#define NET_MGMT_ON_IFACE_MASK 0x40000000
38#define NET_MGMT_LAYER_MASK 0x30000000
39#define NET_MGMT_SYNC_EVENT_MASK 0x08000000
40#define NET_MGMT_LAYER_CODE_MASK 0x07FF0000
41#define NET_MGMT_COMMAND_MASK 0x0000FFFF
43#define NET_MGMT_EVENT_BIT BIT(31)
44#define NET_MGMT_IFACE_BIT BIT(30)
45#define NET_MGMT_SYNC_EVENT_BIT BIT(27)
47#define NET_MGMT_LAYER(_layer) (_layer << 28)
48#define NET_MGMT_LAYER_CODE(_code) (_code << 16)
50#define NET_MGMT_EVENT(mgmt_request) \
51 (mgmt_request & NET_MGMT_EVENT_MASK)
53#define NET_MGMT_ON_IFACE(mgmt_request) \
54 (mgmt_request & NET_MGMT_ON_IFACE_MASK)
56#define NET_MGMT_EVENT_SYNCHRONOUS(mgmt_request) \
57 (mgmt_request & NET_MGMT_SYNC_EVENT_MASK)
59#define NET_MGMT_GET_LAYER(mgmt_request) \
60 ((mgmt_request & NET_MGMT_LAYER_MASK) >> 28)
62#define NET_MGMT_GET_LAYER_CODE(mgmt_request) \
63 ((mgmt_request & NET_MGMT_LAYER_CODE_MASK) >> 16)
65#define NET_MGMT_GET_COMMAND(mgmt_request) \
66 (mgmt_request & NET_MGMT_COMMAND_MASK)
70#define NET_MGMT_LAYER_L2 1
71#define NET_MGMT_LAYER_L3 2
72#define NET_MGMT_LAYER_L4 3
90 void *
data,
size_t len);
92#define net_mgmt(_mgmt_request, _iface, _data, _len) \
93 net_mgmt_##_mgmt_request(_mgmt_request, _iface, _data, _len)
95#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request) \
96 extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \
97 struct net_if *iface, \
98 void *data, size_t len)
100#define NET_MGMT_REGISTER_REQUEST_HANDLER(_mgmt_request, _func) \
101 FUNC_ALIAS(_func, net_mgmt_##_mgmt_request, int)
139#ifdef CONFIG_NET_MGMT_EVENT_INFO
172#ifdef CONFIG_NET_MGMT_EVENT
178 __ASSERT(cb,
"Callback pointer should not be NULL");
179 __ASSERT(
handler,
"Handler pointer should not be NULL");
185#define net_mgmt_init_event_callback(...)
192#ifdef CONFIG_NET_MGMT_EVENT
195#define net_mgmt_add_event_callback(...)
202#ifdef CONFIG_NET_MGMT_EVENT
205#define net_mgmt_del_event_callback(...)
221#ifdef CONFIG_NET_MGMT_EVENT
223 const void *info,
size_t length);
231#define net_mgmt_event_notify(...)
232#define net_mgmt_event_notify_with_info(...)
255#ifdef CONFIG_NET_MGMT_EVENT
293#ifdef CONFIG_NET_MGMT_EVENT
316#ifdef CONFIG_NET_MGMT_EVENT
319#define net_mgmt_event_init(...)
ZTEST_BMEM int timeout
Definition: main.c:31
void
Definition: eswifi_shell.c:15
void(* net_mgmt_event_handler_t)(struct net_mgmt_event_callback *cb, uint32_t mgmt_event, struct net_if *iface)
Define the user's callback handler function signature.
Definition: net_mgmt.h:113
int net_mgmt_event_wait_on_iface(struct net_if *iface, uint32_t mgmt_event_mask, uint32_t *raised_event, const void **info, size_t *info_length, k_timeout_t timeout)
Used to wait synchronously on an event mask for a specific iface.
static void net_mgmt_event_notify(uint32_t mgmt_event, struct net_if *iface)
Definition: net_mgmt.h:225
void net_mgmt_event_notify_with_info(uint32_t mgmt_event, struct net_if *iface, const void *info, size_t length)
Used by the system to notify an event.
void net_mgmt_del_event_callback(struct net_mgmt_event_callback *cb)
Delete a user callback.
static void net_mgmt_init_event_callback(struct net_mgmt_event_callback *cb, net_mgmt_event_handler_t handler, uint32_t mgmt_event_mask)
Helper to initialize a struct net_mgmt_event_callback properly.
Definition: net_mgmt.h:174
void net_mgmt_event_init(void)
Used by the core of the network stack to initialize the network event processing.
int(* net_mgmt_request_handler_t)(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len)
Signature which all Net MGMT request handler need to follow.
Definition: net_mgmt.h:88
int net_mgmt_event_wait(uint32_t mgmt_event_mask, uint32_t *raised_event, struct net_if **iface, const void **info, size_t *info_length, k_timeout_t timeout)
Used to wait synchronously on an event mask.
void net_mgmt_add_event_callback(struct net_mgmt_event_callback *cb)
Add a user callback.
Network core definitions.
Network Events code public header.
struct _snode sys_snode_t
Definition: slist.h:33
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
Kernel timeout type.
Definition: sys_clock.h:65
Network Interface structure.
Definition: net_if.h:468
Network Management event callback structure Used to register a callback into the network management e...
Definition: net_mgmt.h:123
sys_snode_t node
Definition: net_mgmt.h:127
struct k_sem * sync_call
Definition: net_mgmt.h:136
uint32_t raised_event
Definition: net_mgmt.h:162
uint32_t event_mask
Definition: net_mgmt.h:158
net_mgmt_event_handler_t handler
Definition: net_mgmt.h:132
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
static void handler(struct k_timer *timer)
Definition: main.c:19