Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Network Management

Network Management. More...

Data Structures

struct  net_event_ipv6_addr
 Network Management event information structure Used to pass information on network events like NET_EVENT_IPV6_ADDR_ADD, NET_EVENT_IPV6_ADDR_DEL, NET_EVENT_IPV6_MADDR_ADD and NET_EVENT_IPV6_MADDR_DEL when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the information. More...
 
struct  net_event_ipv6_nbr
 Network Management event information structure Used to pass information on network events like NET_EVENT_IPV6_NBR_ADD and NET_EVENT_IPV6_NBR_DEL when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the information. More...
 
struct  net_event_ipv6_route
 Network Management event information structure Used to pass information on network events like NET_EVENT_IPV6_ROUTE_ADD and NET_EVENT_IPV6_ROUTE_DEL when CONFIG_NET_MGMT_EVENT_INFO enabled and event generator pass the information. More...
 
struct  net_event_ipv6_prefix
 Network Management event information structure Used to pass information on network events like NET_EVENT_IPV6_PREFIX_ADD and NET_EVENT_IPV6_PREFIX_DEL when CONFIG_NET_MGMT_EVENT_INFO is enabled and event generator pass the information. More...
 
struct  net_event_l4_hostname
 Network Management event information structure Used to pass information on NET_EVENT_HOSTNAME_CHANGED event when CONFIG_NET_MGMT_EVENT_INFO is enabled and event generator pass the information. More...
 
struct  net_mgmt_event_callback
 Network Management event callback structure Used to register a callback into the network management event part, in order to let the owner of this struct to get network event notification based on given event mask. More...
 

Macros

#define net_mgmt(_mgmt_request, _iface, _data, _len)    net_mgmt_##_mgmt_request(_mgmt_request, _iface, _data, _len)
 
#define NET_MGMT_DEFINE_REQUEST_HANDLER(_mgmt_request)
 
#define NET_MGMT_REGISTER_REQUEST_HANDLER(_mgmt_request, _func)    FUNC_ALIAS(_func, net_mgmt_##_mgmt_request, int)
 
#define NET_MGMT_REGISTER_EVENT_HANDLER(_name, _event_mask, _func, _user_data)
 Define a static network event handler.
 

Typedefs

typedef 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.
 
typedef 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.
 
typedef void(* net_mgmt_event_static_handler_t) (uint32_t mgmt_event, struct net_if *iface, void *info, size_t info_length, void *user_data)
 Define the user's callback handler function signature.
 

Functions

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.
 
void net_mgmt_add_event_callback (struct net_mgmt_event_callback *cb)
 Add a user callback.
 
void net_mgmt_del_event_callback (struct net_mgmt_event_callback *cb)
 Delete a user callback.
 
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.
 
static void net_mgmt_event_notify (uint32_t mgmt_event, struct net_if *iface)
 
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.
 
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.
 
void net_mgmt_event_init (void)
 Used by the core of the network stack to initialize the network event processing.
 

Detailed Description

Network Management.

Macro Definition Documentation

◆ net_mgmt

#define net_mgmt (   _mgmt_request,
  _iface,
  _data,
  _len 
)     net_mgmt_##_mgmt_request(_mgmt_request, _iface, _data, _len)

◆ NET_MGMT_DEFINE_REQUEST_HANDLER

#define NET_MGMT_DEFINE_REQUEST_HANDLER (   _mgmt_request)

#include <zephyr/net/net_mgmt.h>

Value:
extern int net_mgmt_##_mgmt_request(uint32_t mgmt_request, \
struct net_if *iface, \
void *data, size_t len)
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
Network Interface structure.
Definition: net_if.h:634

◆ NET_MGMT_REGISTER_EVENT_HANDLER

#define NET_MGMT_REGISTER_EVENT_HANDLER (   _name,
  _event_mask,
  _func,
  _user_data 
)

#include <zephyr/net/net_mgmt.h>

Value:
const STRUCT_SECTION_ITERABLE(net_mgmt_event_static_handler, _name) = { \
.event_mask = _event_mask, \
.handler = _func, \
.user_data = (void *)_user_data, \
}
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition: iterable_sections.h:216

Define a static network event handler.

Parameters
_nameName of the event handler.
_event_maskA mask of network events on which the passed handler should be called in case those events come. Note that only the command part is treated as a mask, matching one to several commands. Layer and layer code will be made of an exact match. This means that in order to receive events from multiple layers, one must have multiple listeners registered, one for each layer being listened.
_funcThe function to be called upon network events being emitted.
_user_dataUser data passed to the handler being called on network events.

◆ NET_MGMT_REGISTER_REQUEST_HANDLER

#define NET_MGMT_REGISTER_REQUEST_HANDLER (   _mgmt_request,
  _func 
)     FUNC_ALIAS(_func, net_mgmt_##_mgmt_request, int)

Typedef Documentation

◆ net_mgmt_event_handler_t

net_mgmt_event_handler_t

#include <zephyr/net/net_mgmt.h>

Define the user's callback handler function signature.

Parameters
cbOriginal struct net_mgmt_event_callback owning this handler.
mgmt_eventThe network event being notified.
ifaceA pointer on a struct net_if to which the event belongs to, if it's an event on an iface. NULL otherwise.

◆ net_mgmt_event_static_handler_t

net_mgmt_event_static_handler_t

#include <zephyr/net/net_mgmt.h>

Define the user's callback handler function signature.

Parameters
mgmt_eventThe network event being notified.
ifaceA pointer on a struct net_if to which the event belongs to, if it's an event on an iface. NULL otherwise.
infoA valid pointer on a data understood by the handler. NULL otherwise.
info_lengthLength in bytes of the memory pointed by info.
user_dataData provided by the user to the handler.

◆ net_mgmt_request_handler_t

net_mgmt_request_handler_t

#include <zephyr/net/net_mgmt.h>

Signature which all Net MGMT request handler need to follow.

Parameters
mgmt_requestThe exact request value the handler is being called through
ifaceA valid pointer on struct net_if if the request is meant to be tight to a network interface. NULL otherwise.
dataA valid pointer on a data understood by the handler. NULL otherwise.
lenLength in byte of the memory pointed by data.

Function Documentation

◆ net_mgmt_add_event_callback()

void net_mgmt_add_event_callback ( struct net_mgmt_event_callback cb)

#include <zephyr/net/net_mgmt.h>

Add a user callback.

Parameters
cbA valid pointer on user's callback to add.

◆ net_mgmt_del_event_callback()

void net_mgmt_del_event_callback ( struct net_mgmt_event_callback cb)

#include <zephyr/net/net_mgmt.h>

Delete a user callback.

Parameters
cbA valid pointer on user's callback to delete.

◆ net_mgmt_event_init()

void net_mgmt_event_init ( void  )

#include <zephyr/net/net_mgmt.h>

Used by the core of the network stack to initialize the network event processing.

◆ net_mgmt_event_notify()

static void net_mgmt_event_notify ( uint32_t  mgmt_event,
struct net_if iface 
)
inlinestatic

◆ net_mgmt_event_notify_with_info()

void net_mgmt_event_notify_with_info ( uint32_t  mgmt_event,
struct net_if iface,
const void *  info,
size_t  length 
)

#include <zephyr/net/net_mgmt.h>

Used by the system to notify an event.

Parameters
mgmt_eventThe actual network event code to notify
ifacea valid pointer on a struct net_if if only the event is based on an iface. NULL otherwise.
infoa valid pointer on the information you want to pass along with the event. NULL otherwise. Note the data pointed there is normalized by the related event.
lengthsize of the data pointed by info pointer.

Note: info and length are disabled if CONFIG_NET_MGMT_EVENT_INFO is not defined.

◆ net_mgmt_event_wait()

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 
)

#include <zephyr/net/net_mgmt.h>

Used to wait synchronously on an event mask.

Parameters
mgmt_event_maskA mask of relevant events to wait on.
raised_eventa pointer on a uint32_t to get which event from the mask generated the event. Can be NULL if the caller is not interested in that information.
ifacea pointer on a place holder for the iface on which the event has originated from. This is valid if only the event mask has bit NET_MGMT_IFACE_BIT set relevantly, depending on events the caller wants to listen to.
infoa valid pointer if user wants to get the information the event might bring along. NULL otherwise.
info_lengthtells how long the info memory area is. Only valid if the info is not NULL.
timeoutA timeout delay. K_FOREVER can be used to wait indefinitely.
Returns
0 on success, a negative error code otherwise. -ETIMEDOUT will be specifically returned if the timeout kick-in instead of an actual event.

◆ net_mgmt_event_wait_on_iface()

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 
)

#include <zephyr/net/net_mgmt.h>

Used to wait synchronously on an event mask for a specific iface.

Parameters
ifacea pointer on a valid network interface to listen event to
mgmt_event_maskA mask of relevant events to wait on. Listened to events should be relevant to iface events and thus have the bit NET_MGMT_IFACE_BIT set.
raised_eventa pointer on a uint32_t to get which event from the mask generated the event. Can be NULL if the caller is not interested in that information.
infoa valid pointer if user wants to get the information the event might bring along. NULL otherwise.
info_lengthtells how long the info memory area is. Only valid if the info is not NULL.
timeoutA timeout delay. K_FOREVER can be used to wait indefinitely.
Returns
0 on success, a negative error code otherwise. -ETIMEDOUT will be specifically returned if the timeout kick-in instead of an actual event.

◆ net_mgmt_init_event_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 
)
inlinestatic

#include <zephyr/net/net_mgmt.h>

Helper to initialize a struct net_mgmt_event_callback properly.

Parameters
cbA valid application's callback structure pointer.
handlerA valid handler function pointer.
mgmt_event_maskA mask of relevant events for the handler