13#ifndef ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_IMPL_H_
14#define ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_IMPL_H_
97 int optname,
const void *optval,
size_t optlen);
115 int optname,
void *optval,
size_t *optlen);
119#define CONN_MGR_CONN_IMPL_GET_NAME(conn_id) __conn_mgr_conn_##conn_id
120#define CONN_MGR_CONN_IMPL_GET_CTX_TYPE(conn_id) conn_id##_CTX_TYPE
139#define CONN_MGR_CONN_DEFINE(conn_id, conn_api) \
140 const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id) = { \
147#define CONN_MGR_CONN_DECLARE_PUBLIC(conn_id) \
148 extern const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id)
151#define CONN_MGR_CONN_BINDING_GET_NAME(dev_id, sfx) __conn_mgr_bndg_##dev_id##_##sfx
152#define CONN_MGR_CONN_BINDING_GET_DATA(dev_id, sfx) __conn_mgr_bndg_data_##dev_id##_##sfx
153#define CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, sfx) __conn_mgr_bndg_mutex_##dev_id##_##sfx
213#define CONN_MGR_BIND_CONN_INST(dev_id, inst, conn_id) \
214 K_MUTEX_DEFINE(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)); \
215 static CONN_MGR_CONN_IMPL_GET_CTX_TYPE(conn_id) \
216 CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst); \
217 static STRUCT_SECTION_ITERABLE(conn_mgr_conn_binding, \
218 CONN_MGR_CONN_BINDING_GET_NAME(dev_id, inst)) = { \
219 .iface = NET_IF_GET(dev_id, inst), \
220 .impl = &(CONN_MGR_CONN_IMPL_GET_NAME(conn_id)), \
221 .ctx = &(CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst)), \
222 .mutex = &(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)) \
231#define CONN_MGR_BIND_CONN(dev_id, conn_id) \
232 CONN_MGR_BIND_CONN_INST(dev_id, 0, conn_id)
248 if (
iface == binding->iface) {
249 if (binding->impl->api) {
307 binding->
flags &= ~BIT(flag);
333 value = !!(binding->
flags &
BIT(flag));
API for controlling generic network association routines on network devices that support it.
#define K_FOREVER
Generate infinite timeout delay.
Definition kernel.h:1440
static bool conn_mgr_binding_get_flag(struct conn_mgr_conn_binding *binding, enum conn_mgr_if_flag flag)
Check the value of the specified connectivity flag for the provided binding.
Definition conn_mgr_connectivity_impl.h:326
static void conn_mgr_binding_lock(struct conn_mgr_conn_binding *binding)
Lock the passed-in binding, making it safe to access.
Definition conn_mgr_connectivity_impl.h:270
static void conn_mgr_binding_set_flag(struct conn_mgr_conn_binding *binding, enum conn_mgr_if_flag flag, bool value)
Set the value of the specified connectivity flag for the provided binding.
Definition conn_mgr_connectivity_impl.h:302
static struct conn_mgr_conn_binding * conn_mgr_if_get_binding(struct net_if *iface)
Retrieves the conn_mgr binding struct for a provided iface if it exists.
Definition conn_mgr_connectivity_impl.h:245
static void conn_mgr_binding_unlock(struct conn_mgr_conn_binding *binding)
Unlocks the passed-in binding.
Definition conn_mgr_connectivity_impl.h:286
conn_mgr_if_flag
Per-iface connectivity flags.
Definition conn_mgr_connectivity.h:67
#define STRUCT_SECTION_FOREACH(struct_type, iterator)
Iterate over a specified iterable section.
Definition iterable_sections.h:270
int k_mutex_unlock(struct k_mutex *mutex)
Unlock a mutex.
int k_mutex_lock(struct k_mutex *mutex, k_timeout_t timeout)
Lock a mutex.
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
Public API for network interface.
Network Management API public header.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Connectivity Manager Connectivity API structure.
Definition conn_mgr_connectivity_impl.h:43
int(* get_opt)(struct conn_mgr_conn_binding *const binding, int optname, void *optval, size_t *optlen)
Implementation callback for conn_mgr_if_get_opt.
Definition conn_mgr_connectivity_impl.h:114
int(* set_opt)(struct conn_mgr_conn_binding *const binding, int optname, const void *optval, size_t optlen)
Implementation callback for conn_mgr_if_set_opt.
Definition conn_mgr_connectivity_impl.h:96
int(* connect)(struct conn_mgr_conn_binding *const binding)
When called, the connectivity implementation should start attempting to establish connectivity (assoc...
Definition conn_mgr_connectivity_impl.h:53
void(* init)(struct conn_mgr_conn_binding *const binding)
Called once for each iface that has been bound to a connectivity implementation using this API.
Definition conn_mgr_connectivity_impl.h:76
int(* disconnect)(struct conn_mgr_conn_binding *const binding)
When called, the connectivity implementation should disconnect (disassociate), or stop any in-progres...
Definition conn_mgr_connectivity_impl.h:64
Connectivity Manager network interface binding structure.
Definition conn_mgr_connectivity_impl.h:162
const struct conn_mgr_conn_impl * impl
The connectivity implementation the network device is bound to.
Definition conn_mgr_connectivity_impl.h:167
struct net_if * iface
The network interface the connectivity implementation is bound to.
Definition conn_mgr_connectivity_impl.h:164
int timeout
Timeout (seconds)
Definition conn_mgr_connectivity_impl.h:196
uint32_t flags
Connectivity flags.
Definition conn_mgr_connectivity_impl.h:183
void * ctx
Pointer to private, per-iface connectivity context.
Definition conn_mgr_connectivity_impl.h:170
Connectivity Implementation struct.
Definition conn_mgr_connectivity_impl.h:128
struct conn_mgr_conn_api * api
The connectivity API used by the implementation.
Definition conn_mgr_connectivity_impl.h:130
Mutex Structure.
Definition kernel.h:2994
Network Interface structure.
Definition net_if.h:690