Zephyr API 3.6.99
Loading...
Searching...
No Matches
Connection Manager Connectivity API

Connection Manager Connectivity API . More...

Topics

 Connection Manager Connectivity Bulk API
 Connection Manager Bulk API .
 
 Connection Manager Connectivity Implementation API
 Connection Manager Connectivity Implementation API .
 

Macros

#define NET_EVENT_CONN_IF_TIMEOUT    (_NET_MGMT_CONN_IF_EVENT | NET_EVENT_CONN_CMD_IF_TIMEOUT)
 net_mgmt event raised when a connection attempt times out
 
#define NET_EVENT_CONN_IF_FATAL_ERROR    (_NET_MGMT_CONN_IF_EVENT | NET_EVENT_CONN_CMD_IF_FATAL_ERROR)
 net_mgmt event raised when a non-recoverable connectivity error occurs on an iface
 
#define CONN_MGR_IF_NO_TIMEOUT   0
 Value to use with conn_mgr_if_set_timeout and conn_mgr_conn_binding::timeout to indicate no timeout.
 

Enumerations

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

Functions

int conn_mgr_if_connect (struct net_if *iface)
 Connect interface.
 
int conn_mgr_if_disconnect (struct net_if *iface)
 Disconnect interface.
 
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.
 
int conn_mgr_if_set_opt (struct net_if *iface, int optname, const void *optval, size_t optlen)
 Set implementation-specific connectivity options.
 
int conn_mgr_if_get_opt (struct net_if *iface, int optname, void *optval, size_t *optlen)
 Get implementation-specific connectivity options.
 
bool conn_mgr_if_get_flag (struct net_if *iface, enum conn_mgr_if_flag flag)
 Check the value of connectivity flags.
 
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.
 
int conn_mgr_if_get_timeout (struct net_if *iface)
 Get the connectivity timeout for an iface.
 
int conn_mgr_if_set_timeout (struct net_if *iface, int timeout)
 Set the connectivity timeout for an iface.
 

Detailed Description

Connection Manager Connectivity API .

Since
3.4
Version
0.1.0

Macro Definition Documentation

◆ CONN_MGR_IF_NO_TIMEOUT

#define CONN_MGR_IF_NO_TIMEOUT   0

#include <zephyr/net/conn_mgr_connectivity.h>

Value to use with conn_mgr_if_set_timeout and conn_mgr_conn_binding::timeout to indicate no timeout.

◆ NET_EVENT_CONN_IF_FATAL_ERROR

#define NET_EVENT_CONN_IF_FATAL_ERROR    (_NET_MGMT_CONN_IF_EVENT | NET_EVENT_CONN_CMD_IF_FATAL_ERROR)

#include <zephyr/net/conn_mgr_connectivity.h>

net_mgmt event raised when a non-recoverable connectivity error occurs on an iface

◆ NET_EVENT_CONN_IF_TIMEOUT

#define NET_EVENT_CONN_IF_TIMEOUT    (_NET_MGMT_CONN_IF_EVENT | NET_EVENT_CONN_CMD_IF_TIMEOUT)

#include <zephyr/net/conn_mgr_connectivity.h>

net_mgmt event raised when a connection attempt times out

Enumeration Type Documentation

◆ conn_mgr_if_flag

#include <zephyr/net/conn_mgr_connectivity.h>

Per-iface connectivity flags.

Enumerator
CONN_MGR_IF_PERSISTENT 

Persistent.

When set, indicates that the connectivity implementation bound to this iface should attempt to persist connectivity by automatically reconnecting after connection loss.

CONN_MGR_IF_NO_AUTO_CONNECT 

No auto-connect.

When set, conn_mgr will not automatically attempt to connect this iface when it reaches admin-up.

CONN_MGR_IF_NO_AUTO_DOWN 

No auto-down.

When set, conn_mgr will not automatically take the iface admin-down when it stops trying to connect, even if CONFIG_NET_CONNECTION_MANAGER_AUTO_IF_DOWN is enabled.

Function Documentation

◆ conn_mgr_if_connect()

int conn_mgr_if_connect ( struct net_if * iface)

#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 <zephyr/net/conn_mgr_connectivity.h>

Disconnect interface.

If the provided iface has been bound to a connectivity implementation, disconnect/disassociate 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 <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 <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 <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 <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 <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 <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 <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.