13#ifndef ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_IMPL_H_
14#define ZEPHYR_INCLUDE_CONN_MGR_CONNECTIVITY_IMPL_H_
95 int optname,
const void *optval,
size_t optlen);
113 int optname,
void *optval,
size_t *optlen);
117#define CONN_MGR_CONN_IMPL_GET_NAME(conn_id) __conn_mgr_conn_##conn_id
118#define CONN_MGR_CONN_IMPL_GET_CTX_TYPE(conn_id) conn_id##_CTX_TYPE
137#define CONN_MGR_CONN_DEFINE(conn_id, conn_api) \
138 const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id) = { \
145#define CONN_MGR_CONN_DECLARE_PUBLIC(conn_id) \
146 extern const struct conn_mgr_conn_impl CONN_MGR_CONN_IMPL_GET_NAME(conn_id)
149#define CONN_MGR_CONN_BINDING_GET_NAME(dev_id, sfx) __conn_mgr_bndg_##dev_id##_##sfx
150#define CONN_MGR_CONN_BINDING_GET_DATA(dev_id, sfx) __conn_mgr_bndg_data_##dev_id##_##sfx
151#define CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, sfx) __conn_mgr_bndg_mutex_##dev_id##_##sfx
211#define CONN_MGR_BIND_CONN_INST(dev_id, inst, conn_id) \
212 K_MUTEX_DEFINE(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)); \
213 static CONN_MGR_CONN_IMPL_GET_CTX_TYPE(conn_id) \
214 CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst); \
215 static STRUCT_SECTION_ITERABLE(conn_mgr_conn_binding, \
216 CONN_MGR_CONN_BINDING_GET_NAME(dev_id, inst)) = { \
217 .iface = NET_IF_GET(dev_id, inst), \
218 .impl = &(CONN_MGR_CONN_IMPL_GET_NAME(conn_id)), \
219 .ctx = &(CONN_MGR_CONN_BINDING_GET_DATA(dev_id, inst)), \
220 .mutex = &(CONN_MGR_CONN_BINDING_GET_MUTEX(dev_id, inst)) \
229#define CONN_MGR_BIND_CONN(dev_id, conn_id) \
230 CONN_MGR_BIND_CONN_INST(dev_id, 0, conn_id)
246 if (
iface == binding->iface) {
247 if (binding->impl->api) {
305 binding->
flags &= ~BIT(flag);
331 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:1363
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:324
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:268
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:300
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:243
static void conn_mgr_binding_unlock(struct conn_mgr_conn_binding *binding)
Unlocks the passed-in binding.
Definition: conn_mgr_connectivity_impl.h:284
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:41
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:112
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:94
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:51
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:74
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:62
Connectivity Manager network interface binding structure.
Definition: conn_mgr_connectivity_impl.h:160
const struct conn_mgr_conn_impl * impl
The connectivity implementation the network device is bound to.
Definition: conn_mgr_connectivity_impl.h:165
struct net_if * iface
The network interface the connectivity implementation is bound to.
Definition: conn_mgr_connectivity_impl.h:162
int timeout
Timeout (seconds)
Definition: conn_mgr_connectivity_impl.h:194
uint32_t flags
Connectivity flags.
Definition: conn_mgr_connectivity_impl.h:181
void * ctx
Pointer to private, per-iface connectivity context.
Definition: conn_mgr_connectivity_impl.h:168
Connectivity Implementation struct.
Definition: conn_mgr_connectivity_impl.h:126
struct conn_mgr_conn_api * api
The connectivity API used by the implementation.
Definition: conn_mgr_connectivity_impl.h:128
Mutex Structure.
Definition: kernel.h:2917
Network Interface structure.
Definition: net_if.h:678