Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Network Management

Network Management. More...

Data Structures

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)
 

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. More...
 
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. More...
 

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

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 <include/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:60
Network Interface structure.
Definition: net_if.h:468
static fdata_t data[2]
Definition: test_fifo_contexts.c:15

◆ 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 <include/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 the event belongs to, if it's an event on an iface. NULL otherwise.

◆ net_mgmt_request_handler_t

net_mgmt_request_handler_t

#include <include/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 <include/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 <include/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 <include/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 <include/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 <include/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 <include/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 <include/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