Zephyr Project API  3.4.0
A Scalable Open Source RTOS
Connection Manager Connectivity API

Connection Manager Connectivity API. More...

Data Structures

struct  conn_mgr_conn_api
 
struct  conn_mgr_conn_impl
 conn_mgr Connectivity Implementation struct Declares a conn_mgr connectivity layer implementation with the provided API More...
 
struct  conn_mgr_conn_binding
 Connectivity Manager network interface binding structure. More...
 

Macros

#define CONN_MGR_CONN_DEFINE(conn_id, conn_api)
 Define a conn_mgr connectivity implementation that can be bound to network devices. More...
 
#define CONN_MGR_CONN_DECLARE_PUBLIC(conn_id)    extern const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id)
 Helper macro to make a conn_mgr connectivity implementation publicly available. More...
 
#define CONN_MGR_IF_NO_TIMEOUT   0
 
#define CONN_MGR_BIND_CONN_INST(dev_id, inst, conn_id)
 Associate a connectivity implementation with an existing network device instance. More...
 
#define CONN_MGR_BIND_CONN(dev_id, conn_id)    CONN_MGR_BIND_CONN_INST(dev_id, 0, conn_id)
 Associate a connectivity implementation with an existing network device. More...
 

Enumerations

enum  conn_mgr_if_flag { CONN_MGR_IF_PERSISTENT }
 Per-iface connectivity flags. More...
 

Functions

int conn_mgr_if_connect (struct net_if *iface)
 Connect interface. More...
 
int conn_mgr_if_disconnect (struct net_if *iface)
 Disconnect interface. More...
 
bool conn_mgr_if_is_bound (struct net_if *iface)
 Check whether the provided network interface supports connectivity / has been bound to a connectivity implementation. More...
 
int conn_mgr_if_set_opt (struct net_if *iface, int optname, const void *optval, size_t optlen)
 Set implementation-specific connectivity options. More...
 
int conn_mgr_if_get_opt (struct net_if *iface, int optname, void *optval, size_t *optlen)
 Get implementation-specific connectivity options. More...
 
bool conn_mgr_if_get_flag (struct net_if *iface, enum conn_mgr_if_flag flag)
 Check the value of connectivity flags. More...
 
int conn_mgr_if_set_flag (struct net_if *iface, enum conn_mgr_if_flag flag, bool value)
 Set the value of a connectivity flags. More...
 
int conn_mgr_if_get_timeout (struct net_if *iface)
 Get the connectivity timeout for an iface. More...
 
int conn_mgr_if_set_timeout (struct net_if *iface, int timeout)
 Set the connectivity timeout for an iface. More...
 
void conn_mgr_conn_init (void)
 Initialize all connectivity implementation bindings. More...
 

Detailed Description

Connection Manager Connectivity API.

Macro Definition Documentation

◆ CONN_MGR_BIND_CONN

#define CONN_MGR_BIND_CONN (   dev_id,
  conn_id 
)     CONN_MGR_BIND_CONN_INST(dev_id, 0, conn_id)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Associate a connectivity implementation with an existing network device.

Parameters
dev_idNetwork device id.
conn_idName of the connectivity implementation to associate.

◆ CONN_MGR_BIND_CONN_INST

#define CONN_MGR_BIND_CONN_INST (   dev_id,
  inst,
  conn_id 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Value:
K_MUTEX_DEFINE(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)); \
static CONN_MGR_CONN_IMPL_GET_CTX_TYPE(conn_id) \
CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst); \
CONN_MGR_CONN_BINDING_GET_NAME(dev_id, inst)) = { \
.iface = NET_IF_GET(dev_id, inst), \
.impl = &(CONN_MGR_CONN_IMPL_GET_NAME(conn_id)), \
.ctx = &(CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst)), \
.mutex = &(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)) \
};
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition: iterable_sections.h:216
#define K_MUTEX_DEFINE(name)
Statically define and initialize a mutex.
Definition: kernel.h:2861
struct k_mutex mutex
Definition: kobject.c:1321
Connectivity Manager network interface binding structure.
Definition: conn_mgr_connectivity.h:196

Associate a connectivity implementation with an existing network device instance.

Parameters
dev_idNetwork device id.
instNetwork device instance.
conn_idName of the connectivity implementation to associate.

◆ CONN_MGR_CONN_DECLARE_PUBLIC

#define CONN_MGR_CONN_DECLARE_PUBLIC (   conn_id)     extern const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Helper macro to make a conn_mgr connectivity implementation publicly available.

◆ CONN_MGR_CONN_DEFINE

#define CONN_MGR_CONN_DEFINE (   conn_id,
  conn_api 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Value:
const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id) = { \
.api = conn_api, \
};
conn_mgr Connectivity Implementation struct Declares a conn_mgr connectivity layer implementation wit...
Definition: conn_mgr_connectivity.h:143
struct conn_mgr_conn_api * api
Definition: conn_mgr_connectivity.h:145

Define a conn_mgr connectivity implementation that can be bound to network devices.

Parameters
conn_idThe name of the new connectivity implementation
conn_apiA pointer to a conn_mgr_conn_api struct

◆ CONN_MGR_IF_NO_TIMEOUT

#define CONN_MGR_IF_NO_TIMEOUT   0

Enumeration Type Documentation

◆ conn_mgr_if_flag

#include <include/zephyr/net/conn_mgr_connectivity.h>

Per-iface connectivity flags.

Enumerator
CONN_MGR_IF_PERSISTENT 

Function Documentation

◆ conn_mgr_conn_init()

void conn_mgr_conn_init ( void  )

#include <include/zephyr/net/conn_mgr_connectivity.h>

Initialize all connectivity implementation bindings.

◆ conn_mgr_if_connect()

int conn_mgr_if_connect ( struct net_if iface)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Connect interface.

If the provided iface has been bound to a connectivity implementation, initiate network connect/association.

Automatically takes the iface admin-up (by calling net_if_up) if it isn't already.

Non-Blocking.

Parameters
ifacePointer to network interface
Return values
0on success.
-ESHUTDOWNif the iface is not admin-up.
-ENOTSUPif the iface does not have a connectivity implementation.
implementation-specificstatus code otherwise.

◆ conn_mgr_if_disconnect()

int conn_mgr_if_disconnect ( struct net_if iface)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Disconnect interface.

If the provided iface has been bound to a connectivity implementation, disconnect/dissassociate it from the network, and cancel any pending attempts to connect/associate.

Does nothing if the iface is currently admin-down.

Parameters
ifacePointer to network interface
Return values
0on success.
-ENOTSUPif the iface does not have a connectivity implementation.
implementation-specificstatus code otherwise.

◆ conn_mgr_if_get_flag()

bool conn_mgr_if_get_flag ( struct net_if iface,
enum conn_mgr_if_flag  flag 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Check the value of connectivity flags.

If the provided iface is bound to a connectivity implementation, retrieves the value of the specified connectivity flag associated with that iface.

Parameters
iface- Pointer to the network interface to check.
flag- The flag to check.
Returns
True if the flag is set, otherwise False. Also returns False if the provided iface is not bound to a connectivity implementation, or the requested flag doesn't exist.

◆ conn_mgr_if_get_opt()

int conn_mgr_if_get_opt ( struct net_if iface,
int  optname,
void *  optval,
size_t optlen 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Get implementation-specific connectivity options.

If the provided iface has been bound to a connectivity implementation that supports it, retrieves implementation-specific connectivity options related to the iface.

Parameters
ifacePointer to the network interface.
optnameInteger value representing the option to set. The meaning of values is up to the conn_mgr_conn_api implementation. Some settings may be shared by multiple ifaces.
optvalPointer to where the retrieved value should be stored.
optlenPointer to length (in bytes) of the destination buffer available for storing the retrieved value. If the available space is less than what is needed, -ENOBUFS is returned. If the available space is invalid, -EINVAL is returned.

optlen will always be set to the total number of bytes written, regardless of whether an error is returned, even if zero bytes were written.

Return values
0if successful.
-ENOTSUPif conn_mgr_if_get_opt is not implemented by the iface.
-ENOBUFSif retrieval buffer is too small.
-EINVALif invalid retrieval buffer length is provided, or if NULL optval or optlen pointer provided.
-ENOPROTOOPTif the optname is not recognized.
implementation-specificerror code otherwise.

◆ conn_mgr_if_get_timeout()

int conn_mgr_if_get_timeout ( struct net_if iface)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Get the connectivity timeout for an iface.

If the provided iface is bound to a connectivity implementation, retrieves the timeout setting in seconds for it.

Parameters
iface- Pointer to the iface to check.
Returns
int - The connectivity timeout value (in seconds) if it could be retrieved, otherwise CONN_MGR_IF_NO_TIMEOUT.

◆ conn_mgr_if_is_bound()

bool conn_mgr_if_is_bound ( struct net_if iface)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Check whether the provided network interface supports connectivity / has been bound to a connectivity implementation.

Parameters
ifacePointer to the iface to check.
Return values
trueif connectivity is supported (a connectivity implementation has been bound).
falseotherwise.

◆ conn_mgr_if_set_flag()

int conn_mgr_if_set_flag ( struct net_if iface,
enum conn_mgr_if_flag  flag,
bool  value 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Set the value of a connectivity flags.

If the provided iface is bound to a connectivity implementation, sets the value of the specified connectivity flag associated with that iface.

Parameters
iface- Pointer to the network interface to modify.
flag- The flag to set.
value- Whether the flag should be enabled or disabled.
Return values
0on success.
-EINVALif the flag does not exist.
-ENOTSUPif the provided iface is not bound to a connectivity implementation.

◆ conn_mgr_if_set_opt()

int conn_mgr_if_set_opt ( struct net_if iface,
int  optname,
const void *  optval,
size_t  optlen 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Set implementation-specific connectivity options.

If the provided iface has been bound to a connectivity implementation that supports it, implementation-specific connectivity options related to the iface.

Parameters
ifacePointer to the network interface.
optnameInteger value representing the option to set. The meaning of values is up to the conn_mgr_conn_api implementation. Some settings may affect multiple ifaces.
optvalPointer to the value to be assigned to the option.
optlenLength (in bytes) of the value to be assigned to the option.
Return values
0if successful.
-ENOTSUPif conn_mgr_if_set_opt not implemented by the iface.
-ENOBUFSif optlen is too long.
-EINVALif NULL optval pointer provided.
-ENOPROTOOPTif the optname is not recognized.
implementation-specificerror code otherwise.

◆ conn_mgr_if_set_timeout()

int conn_mgr_if_set_timeout ( struct net_if iface,
int  timeout 
)

#include <include/zephyr/net/conn_mgr_connectivity.h>

Set the connectivity timeout for an iface.

If the provided iface is bound to a connectivity implementation, sets the timeout setting in seconds for it.

Parameters
iface- Pointer to the network interface to modify.
timeout- The timeout value to set (in seconds). Pass CONN_MGR_IF_NO_TIMEOUT to disable the timeout.
Return values
0on success.
-ENOTSUPif the provided iface is not bound to a connectivity implementation.