Zephyr Project API 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
openthread.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11#ifndef ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
12#define ZEPHYR_INCLUDE_NET_OPENTHREAD_H_
13
23#include <zephyr/kernel.h>
24#include <zephyr/net/net_if.h>
26
27#include <openthread.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
39struct pkt_list_elem {
40 struct net_pkt *pkt;
41};
42
46struct openthread_context {
50 __deprecated otInstance *instance;
51
53 struct net_if *iface;
54
56 uint16_t pkt_list_in_idx;
57
59 uint16_t pkt_list_out_idx;
60
62 uint8_t pkt_list_full;
63
65 struct pkt_list_elem pkt_list[CONFIG_OPENTHREAD_PKT_LIST_SIZE];
66
70 __deprecated struct k_mutex api_lock;
71
75 __deprecated struct k_work_q work_q;
76
80 __deprecated struct k_work api_work;
81
85 sys_slist_t state_change_cbs;
86};
112 void (*state_changed_cb)(otChangedFlags flags, struct openthread_context *ot_context,
113 void *user_data);
114
117
123};
124
134__deprecated int openthread_state_changed_cb_register(struct openthread_context *ot_context,
135 struct openthread_state_changed_cb *cb);
136
145__deprecated int openthread_state_changed_cb_unregister(struct openthread_context *ot_context,
146 struct openthread_state_changed_cb *cb);
147
154struct openthread_context *openthread_get_default_context(void);
155
167__deprecated int openthread_start(struct openthread_context *ot_context);
168
180__deprecated void openthread_api_mutex_lock(struct openthread_context *ot_context);
181
195__deprecated int openthread_api_mutex_try_lock(struct openthread_context *ot_context);
196
204__deprecated void openthread_api_mutex_unlock(struct openthread_context *ot_context);
205
208#define OPENTHREAD_L2_CTX_TYPE struct openthread_context
209
212#ifdef __cplusplus
213}
214#endif
215
220#endif /* ZEPHYR_INCLUDE_NET_OPENTHREAD_H_ */
int openthread_api_mutex_try_lock(struct openthread_context *ot_context)
Try to lock internal mutex before accessing OT API.
void openthread_api_mutex_unlock(struct openthread_context *ot_context)
Unlock internal mutex after accessing OT API.
void openthread_api_mutex_lock(struct openthread_context *ot_context)
Lock internal mutex before accessing OT API.
int openthread_state_changed_cb_register(struct openthread_context *ot_context, struct openthread_state_changed_cb *cb)
Registers callbacks which will be called when certain configuration or state changes occur within Ope...
int openthread_start(struct openthread_context *ot_context)
Starts the OpenThread network.
int openthread_state_changed_cb_unregister(struct openthread_context *ot_context, struct openthread_state_changed_cb *cb)
Unregisters OpenThread configuration or state changed callbacks.
struct openthread_context * openthread_get_default_context(void)
Get pointer to default OpenThread context.
struct _slist sys_slist_t
Single-linked list structure.
Definition slist.h:49
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public kernel APIs.
Public API for network interface.
OpenThread stack public header.
flags
Definition parser.h:97
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Mutex Structure.
Definition kernel.h:3070
A structure used to hold work until it can be processed.
Definition kernel.h:4235
A structure used to submit work.
Definition kernel.h:4073
Network Interface structure.
Definition net_if.h:715
Network packet.
Definition net_pkt.h:91
OpenThread state change callback
Definition openthread.h:103
sys_snode_t node
Internally used field for list handling.
Definition openthread.h:122
void(* state_changed_cb)(otChangedFlags flags, struct openthread_context *ot_context, void *user_data)
Callback for notifying configuration or state changes.
Definition openthread.h:112
void * user_data
User data if required.
Definition openthread.h:116