26#include "nimble/porting/nimble/include/syscfg/syscfg.h"
27#include "nimble/porting/nimble/include/logcfg/logcfg.h"
28#include "nimble/porting/nimble/include/modlog/modlog.h"
29#include "nimble/nimble/include/nimble/nimble_npl.h"
31#include "nimble/porting/nimble/include/os/os_mbuf.h"
32#include "nimble/porting/nimble/include/os/queue.h"
34#include "nimble/nimble/include/nimble/ble.h"
35#include "nimble/nimble/host/include/host/ble_hs.h"
36#include "nimble/nimble/host/include/host/ble_uuid.h"
37#include "nimble/nimble/host/src/ble_sm_priv.h"
38#include "nimble/nimble/host/src/ble_hs_hci_priv.h"
40#if MYNEWT_VAL(BLE_CRYPTO_STACK_MBEDTLS)
41#include "mbedtls/aes.h"
42#include "mbedtls/cipher.h"
43#include "mbedtls/entropy.h"
44#include "mbedtls/ctr_drbg.h"
45#include "mbedtls/cmac.h"
46#include "mbedtls/ecdh.h"
47#include "mbedtls/ecp.h"
57#if MYNEWT_VAL(BLE_MESH_SETTINGS)
58#include "config/config.h"
65#define SETTINGS_MAX_DIR_DEPTH 8
68#define BT_ECC_KEY_SIZE 32
70#define BT_PUB_KEY_COORD_LEN (BT_ECC_KEY_SIZE)
72#define BT_PUB_KEY_LEN (2 * (BT_PUB_KEY_COORD_LEN))
74#define BT_PRIV_KEY_LEN (BT_ECC_KEY_SIZE)
76#define BT_DH_KEY_LEN (BT_ECC_KEY_SIZE)
87#define BT_DATA(_type, _data, _data_len) \
90 .data_len = (_data_len), \
91 .data = (const uint8_t *)(_data), \
102#define BT_DATA_BYTES(_type, _bytes...) \
103 BT_DATA(_type, ((uint8_t []) { _bytes }), \
104 sizeof((uint8_t []) { _bytes }))
107#define BT_DATA_FLAGS 0x01
108#define BT_DATA_UUID16_SOME 0x02
109#define BT_DATA_UUID16_ALL 0x03
110#define BT_DATA_UUID32_SOME 0x04
111#define BT_DATA_UUID32_ALL 0x05
112#define BT_DATA_UUID128_SOME 0x06
113#define BT_DATA_UUID128_ALL 0x07
114#define BT_DATA_NAME_SHORTENED 0x08
115#define BT_DATA_NAME_COMPLETE 0x09
116#define BT_DATA_TX_POWER 0x0a
117#define BT_DATA_SOLICIT16 0x14
118#define BT_DATA_SOLICIT128 0x15
119#define BT_DATA_SVC_DATA16 0x16
120#define BT_DATA_GAP_APPEARANCE 0x19
121#define BT_DATA_SOLICIT32 0x1f
122#define BT_DATA_SVC_DATA32 0x20
123#define BT_DATA_SVC_DATA128 0x21
124#define BT_DATA_URI 0x24
125#define BT_DATA_MESH_PROV 0x29
126#define BT_DATA_MESH_MESSAGE 0x2a
127#define BT_DATA_MESH_BEACON 0x2b
129#define BT_DATA_MANUFACTURER_DATA 0xff
131#define BT_LE_AD_LIMITED 0x01
132#define BT_LE_AD_GENERAL 0x02
133#define BT_LE_AD_NO_BREDR 0x04
135#define sys_put_be16(a,b) put_be16(b, a)
136#define sys_put_le16(a,b) put_le16(b, a)
137#define sys_put_le24(a,b) put_le24(b, a)
138#define sys_put_be24(a,b) put_be24(b, a)
139#define sys_put_be32(a,b) put_be32(b, a)
140#define sys_get_be16(a) get_be16(a)
141#define sys_get_be24(a) get_be24(a)
142#define sys_get_le16(a) get_le16(a)
143#define sys_get_le24(a) get_le24(a)
144#define sys_get_be32(a) get_be32(a)
145#define sys_cpu_to_be16(a) htobe16(a)
146#define sys_cpu_to_be32(a) htobe32(a)
147#define sys_be32_to_cpu(a) be32toh(a)
148#define sys_be16_to_cpu(a) be16toh(a)
149#define sys_le16_to_cpu(a) le16toh(a)
152#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
155#define CODE_UNREACHABLE __builtin_unreachable()
156#define __ASSERT(code, str) \
158 if (!(code)) BT_ERR(str); \
162#define __ASSERT_NO_MSG(test) __ASSERT(test, "")
166#define ASSERT_NOT_CHAIN(om) assert(SLIST_NEXT(om, om_next) == NULL)
168#define ASSERT_NOT_CHAIN(om) (void)(om)
171#define CHECKIF(expr) \
172 __ASSERT_NO_MSG(!(expr)); \
175#define __packed __attribute__((__packed__))
177#define MSEC_PER_SEC (1000)
178#define K_MSEC(ms) (ms)
179#define K_SECONDS(s) K_MSEC((s) * MSEC_PER_SEC)
180#define K_MINUTES(m) K_SECONDS((m) * 60)
181#define K_HOURS(h) K_MINUTES((h) * 60)
184#define BIT(n) (1UL << (n))
187#define BIT_MASK(n) (BIT(n) - 1)
189#define BT_GAP_ADV_FAST_INT_MIN_1 0x0030
190#define BT_GAP_ADV_FAST_INT_MAX_1 0x0060
191#define BT_GAP_ADV_FAST_INT_MIN_2 0x00a0
192#define BT_GAP_ADV_FAST_INT_MAX_2 0x00f0
193#define BT_GAP_ADV_SLOW_INT_MIN 0x0640
194#define BT_GAP_ADV_SLOW_INT_MAX 0x0780
196#ifndef MESH_LOG_MODULE
197#define MESH_LOG_MODULE BLE_MESH_LOG
200#define CAT(a, ...) PRIMITIVE_CAT(a, __VA_ARGS__)
201#define PRIMITIVE_CAT(a, ...) a ## __VA_ARGS__
203#define BLE_MESH_LOG(lvl, ...) CAT(MESH_LOG_MODULE, CAT(_, lvl))(__VA_ARGS__)
205#define BT_DBG(fmt, ...) BLE_MESH_LOG(DEBUG, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
206#define BT_INFO(fmt, ...) BLE_MESH_LOG(INFO, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
207#define BT_WARN(fmt, ...) BLE_MESH_LOG(WARN, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
208#define BT_ERR(fmt, ...) BLE_MESH_LOG(ERROR, "%s: " fmt "\n", __func__, ## __VA_ARGS__);
209#define BT_GATT_ERR(_att_err) (-(_att_err))
211typedef ble_addr_t bt_addr_le_t;
213#define k_fifo_init(queue) ble_npl_eventq_init(queue)
214#define net_buf_simple_tailroom(buf) OS_MBUF_TRAILINGSPACE(buf)
215#define net_buf_tailroom(buf) net_buf_simple_tailroom(buf)
216#define net_buf_headroom(buf) ((buf)->om_data - &(buf)->om_databuf[buf->om_pkthdr_len])
217#define net_buf_simple_headroom(buf) net_buf_headroom(buf)
218#define net_buf_simple_tail(buf) ((buf)->om_data + (buf)->om_len)
220struct net_buf_simple_state {
227static inline struct os_mbuf * NET_BUF_SIMPLE(uint16_t size)
238#define K_FOREVER (-1)
240#if MYNEWT_VAL(BLE_EXT_ADV)
241#define BT_MESH_ADV_INST (MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES))
243#if MYNEWT_VAL(BLE_MESH_PROXY)
247#if MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) < 1
248#error "Mesh needs at least BLE_MULTI_ADV_INSTANCES set to 1"
250#define BT_MESH_ADV_GATT_INST (MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) - 1)
255static inline void net_buf_simple_init(
struct os_mbuf *buf,
264#define net_buf_simple_init_with_data(buf, data, size) \
265 os_mbuf_copyinto(buf, 0, data, size);
267static inline void net_buf_simple_reset(
struct os_mbuf *om)
269 net_buf_simple_init(om, 0);
272struct bt_le_ext_adv_start_param {
278void net_buf_put(
struct ble_npl_eventq *fifo,
struct os_mbuf *buf);
279void * net_buf_ref(
struct os_mbuf *om);
280void net_buf_unref(
struct os_mbuf *om);
281uint16_t net_buf_simple_pull_le16(
struct os_mbuf *om);
282uint16_t net_buf_simple_pull_be16(
struct os_mbuf *om);
283uint32_t net_buf_simple_pull_le24(
struct os_mbuf *om);
284uint32_t net_buf_simple_pull_be32(
struct os_mbuf *om);
285uint32_t net_buf_simple_pull_le32(
struct os_mbuf *om);
286uint8_t net_buf_simple_pull_u8(
struct os_mbuf *om);
287void net_buf_simple_add_le16(
struct os_mbuf *om, uint16_t val);
288void net_buf_simple_add_be16(
struct os_mbuf *om, uint16_t val);
289void net_buf_simple_add_le24(
struct os_mbuf *om, uint32_t val);
290void net_buf_simple_add_u8(
struct os_mbuf *om, uint8_t val);
291void net_buf_simple_add_be32(
struct os_mbuf *om, uint32_t val);
292void net_buf_simple_add_le32(
struct os_mbuf *om, uint32_t val);
293void net_buf_add_zeros(
struct os_mbuf *om, uint8_t len);
294void net_buf_simple_push_le16(
struct os_mbuf *om, uint16_t val);
295void net_buf_simple_push_be16(
struct os_mbuf *om, uint16_t val);
296void net_buf_simple_push_be24(
struct os_mbuf *om, uint32_t val);
297void net_buf_simple_push_u8(
struct os_mbuf *om, uint8_t val);
298void *net_buf_simple_pull(
struct os_mbuf *om, uint8_t len);
299void *net_buf_simple_pull_mem(
struct os_mbuf *om, uint8_t len);
300void *net_buf_simple_add(
struct os_mbuf *om, uint8_t len);
301bool k_fifo_is_empty(
struct ble_npl_eventq *q);
302void *net_buf_get(
struct ble_npl_eventq *fifo,int32_t t);
303uint8_t *net_buf_simple_push(
struct os_mbuf *om, uint8_t len);
304void net_buf_reserve(
struct os_mbuf *om,
size_t reserve);
306#define net_buf_add_mem(a,b,c) os_mbuf_append(a,b,c)
307#define net_buf_simple_add_mem(a,b,c) os_mbuf_append(a,b,c)
308#define net_buf_add_u8(a,b) net_buf_simple_add_u8(a,b)
309#define net_buf_add(a,b) net_buf_simple_add(a,b)
311#define net_buf_clone(a, b) os_mbuf_dup(a)
312#define net_buf_add_be32(a, b) net_buf_simple_add_be32(a, b)
313#define net_buf_add_be16(a, b) net_buf_simple_add_be16(a, b)
314#define net_buf_pull(a, b) net_buf_simple_pull_mem(a, b)
315#define net_buf_pull_mem(a, b) net_buf_simple_pull_mem(a, b)
316#define net_buf_pull_u8(a) net_buf_simple_pull_u8(a)
317#define net_buf_pull_be16(a) net_buf_simple_pull_be16(a)
318#define net_buf_skip(a, b) net_buf_simple_pull_mem(a, b)
320#define BT_GATT_CCC_NOTIFY BLE_GATT_CHR_PROP_NOTIFY
323#define MIN(a, b) (((a) < (b)) ? (a) : (b))
327#define MAX(a, b) (((a) > (b)) ? (a) : (b))
340struct bt_pub_key_cb {
349 void (*func)(
const uint8_t key[BT_PUB_KEY_LEN]);
351 struct bt_pub_key_cb *_next;
422typedef void (*bt_dh_key_cb_t)(
const uint8_t key[BT_DH_KEY_LEN]);
423int bt_dh_key_gen(
const uint8_t remote_pk[BT_PUB_KEY_LEN], bt_dh_key_cb_t cb);
424int bt_pub_key_gen(
struct bt_pub_key_cb *new_cb);
425uint8_t *bt_pub_key_get(
void);
427int bt_rand(
void *buf,
size_t len);
428const char * bt_hex(
const void *buf,
size_t len);
429int bt_encrypt_be(
const uint8_t *key,
const uint8_t *plaintext, uint8_t *enc_data);
430int bt_ccm_decrypt(
const uint8_t key[16], uint8_t nonce[13],
const uint8_t *enc_data,
431 size_t len,
const uint8_t *aad,
size_t aad_len,
432 uint8_t *plaintext,
size_t mic_size);
433int bt_ccm_encrypt(
const uint8_t key[16], uint8_t nonce[13],
const uint8_t *enc_data,
434 size_t len,
const uint8_t *aad,
size_t aad_len,
435 uint8_t *plaintext,
size_t mic_size);
436void bt_mesh_register_gatt(
void);
438 const struct bt_data *ad,
size_t ad_len,
439 const struct bt_data *sd,
size_t sd_len);
441int bt_le_adv_stop(
void);
443struct k_work_delayable {
444 struct ble_npl_callout work;
447void k_work_init(
struct ble_npl_callout *work, ble_npl_event_fn handler);
448void k_work_init_delayable(
struct k_work_delayable *w, ble_npl_event_fn *f);
449void k_work_cancel_delayable(
struct k_work_delayable *w);
450bool k_work_delayable_is_pending(
struct k_work_delayable *w);
451void k_work_reschedule(
struct k_work_delayable *w, uint32_t ms);
452int64_t k_uptime_get(
void);
453uint32_t k_uptime_get_32(
void);
454int64_t k_uptime_delta(int64_t *reftime);
455void k_sleep(int32_t duration);
456void k_work_submit(
struct ble_npl_callout *w);
457void k_work_add_arg(
struct ble_npl_callout *w,
void *arg);
458void k_work_add_arg_delayable(
struct k_work_delayable *w,
void *arg);
459ble_npl_time_t k_work_delayable_remaining_get(
struct k_work_delayable *w);
460void k_work_schedule(
struct k_work_delayable *w, uint32_t ms);
461uint32_t k_ticks_to_ms_floor32(ble_npl_time_t ticks);
463static inline void net_buf_simple_save(
struct os_mbuf *buf,
464 struct net_buf_simple_state *state)
466 state->offset = net_buf_simple_headroom(buf);
470void net_buf_simple_clone(
const struct os_mbuf *original,
struct os_mbuf *clone);
472static inline void net_buf_simple_restore(
struct os_mbuf *buf,
473 struct net_buf_simple_state *state)
479static inline void sys_memcpy_swap(
void *dst,
const void *src,
size_t length)
481 __ASSERT(((src < dst && (src + length) <= dst) ||
482 (src > dst && (dst + length) <= src)),
483 "Source and destination buffers must not overlap");
487 for (; length > 0; length--) {
488 *((uint8_t *)dst++) = *((uint8_t *)src--);
492#define popcount(x) __builtin_popcount(x)
494static inline unsigned int find_lsb_set(uint32_t op)
496 return __builtin_ffs(op);
499static inline unsigned int find_msb_set(uint32_t op)
504 return 32 - __builtin_clz(op);
507#define CONFIG_BT_MESH_FRIEND BLE_MESH_FRIEND
508#define CONFIG_BT_MESH_GATT_PROXY BLE_MESH_GATT_PROXY
509#define CONFIG_BT_MESH_IV_UPDATE_TEST BLE_MESH_IV_UPDATE_TEST
510#define CONFIG_BT_MESH_LOW_POWER BLE_MESH_LOW_POWER
511#define CONFIG_BT_MESH_LPN_SUB_ALL_NODES_ADDR BLE_MESH_LPN_SUB_ALL_NODES_ADDR
512#define CONFIG_BT_MESH_LPN_AUTO BLE_MESH_LPN_AUTO
513#define CONFIG_BT_MESH_LPN_ESTABLISHMENT BLE_MESH_LPN_ESTABLISHMENT
514#define CONFIG_BT_MESH_PB_ADV BLE_MESH_PB_ADV
515#define CONFIG_BT_MESH_PB_GATT BLE_MESH_PB_GATT
516#define CONFIG_BT_MESH_PROV BLE_MESH_PROV
517#define CONFIG_BT_MESH_PROXY BLE_MESH_PROXY
518#define CONFIG_BT_TESTING BLE_MESH_TESTING
519#define CONFIG_BT_SETTINGS BLE_MESH_SETTINGS
520#define CONFIG_SETTINGS BLE_MESH_SETTINGS
521#define CONFIG_BT_MESH_PROVISIONER BLE_MESH_PROVISIONER
522#define CONFIG_BT_MESH_PROV_DEVICE BLE_MESH_PROV_DEVICE
523#define CONFIG_BT_MESH_CDB BLE_MESH_CDB
524#define CONFIG_BT_MESH_DEBUG_CFG BLE_MESH_DEBUG_CFG
525#define CONFIG_BT_MESH_DEBUG_ADV BLE_MESH_DEBUG_ADV
528#define IS_ENABLED(config) MYNEWT_VAL(config)
530#define CONFIG_BT_MESH_LPN_GROUPS MYNEWT_VAL(BLE_MESH_LPN_GROUPS)
531#define CONFIG_BT_MESH_ADV_BUF_COUNT MYNEWT_VAL(BLE_MESH_ADV_BUF_COUNT)
532#define CONFIG_BT_MESH_SEG_BUFS MYNEWT_VAL(BLE_MESH_SEG_BUFS)
533#define CONFIG_BT_MESH_FRIEND_QUEUE_SIZE MYNEWT_VAL(BLE_MESH_FRIEND_QUEUE_SIZE)
534#define CONFIG_BT_MESH_FRIEND_RECV_WIN MYNEWT_VAL(BLE_MESH_FRIEND_RECV_WIN)
535#define CONFIG_BT_MESH_LPN_POLL_TIMEOUT MYNEWT_VAL(BLE_MESH_LPN_POLL_TIMEOUT)
536#define CONFIG_BT_MESH_MODEL_GROUP_COUNT MYNEWT_VAL(BLE_MESH_MODEL_GROUP_COUNT)
537#define CONFIG_BT_MESH_MODEL_KEY_COUNT MYNEWT_VAL(BLE_MESH_MODEL_KEY_COUNT)
538#define CONFIG_BT_MESH_NODE_ID_TIMEOUT MYNEWT_VAL(BLE_MESH_NODE_ID_TIMEOUT)
539#define CONFIG_BT_MAX_CONN MYNEWT_VAL(BLE_MAX_CONNECTIONS)
540#define CONFIG_BT_MESH_SEQ_STORE_RATE MYNEWT_VAL(BLE_MESH_SEQ_STORE_RATE)
541#define CONFIG_BT_MESH_RPL_STORE_TIMEOUT MYNEWT_VAL(BLE_MESH_RPL_STORE_TIMEOUT)
542#define CONFIG_BT_MESH_APP_KEY_COUNT MYNEWT_VAL(BLE_MESH_APP_KEY_COUNT)
543#define CONFIG_BT_MESH_SUBNET_COUNT MYNEWT_VAL(BLE_MESH_SUBNET_COUNT)
544#define CONFIG_BT_MESH_STORE_TIMEOUT MYNEWT_VAL(BLE_MESH_STORE_TIMEOUT)
545#define CONFIG_BT_MESH_IV_UPDATE_SEQ_LIMIT MYNEWT_VAL(BLE_MESH_IV_UPDATE_SEQ_LIMIT)
546#define CONFIG_BT_MESH_IVU_DIVIDER MYNEWT_VAL(BLE_MESH_IVU_DIVIDER)
547#define CONFIG_BT_DEVICE_NAME MYNEWT_VAL(BLE_MESH_DEVICE_NAME)
548#define CONFIG_BT_RX_SEG_MAX MYNEWT_VAL(BLE_MESH_RX_SEG_MAX)
549#define CONFIG_BT_MESH_TX_SEG_MAX MYNEWT_VAL(BLE_MESH_TX_SEG_MAX)
550#define CONFIG_BT_MESH_RX_SEG_MAX MYNEWT_VAL(BLE_MESH_RX_SEG_MAX)
551#define CONFIG_BT_MESH_RX_SEG_MSG_COUNT MYNEWT_VAL(BLE_MESH_RX_SEG_MSG_COUNT)
552#define CONFIG_BT_MESH_LABEL_COUNT MYNEWT_VAL(BLE_MESH_LABEL_COUNT)
553#define CONFIG_BT_MESH_MODEL_VND_MSG_CID_FORCE MYNEWT_VAL(BLE_MESH_MODEL_VND_MSG_CID_FORCE)
554#define CONFIG_BT_MESH_NODE_COUNT MYNEWT_VAL(BLE_MESH_CDB_NODE_COUNT)
555#define CONFIG_BT_GATT_PROXY_ENABLED MYNEWT_VAL(BLE_MESH_GATT_PROXY_ENABLED)
556#define CONFIG_BT_MESH_DEFAULT_TTL MYNEWT_VAL(BLE_MESH_DEFAULT_TTL)
557#define CONFIG_BT_MESH_NETWORK_TRANSMIT_COUNT MYNEWT_VAL(BLE_MESH_NETWORK_TRANSMIT_COUNT)
558#define CONFIG_BT_MESH_NETWORK_TRANSMIT_INTERVAL MYNEWT_VAL(BLE_MESH_NETWORK_TRANSMIT_INTERVAL)
559#define CONFIG_BT_MESH_RELAY_ENABLED MYNEWT_VAL(BLE_MESH_RELAY_ENABLED)
560#define CONFIG_BT_MESH_RELAY_RETRANSMIT_INTERVAL MYNEWT_VAL(BLE_MESH_RELAY_RETRANSMIT_INTERVAL)
561#define CONFIG_BT_MESH_BEACON_ENABLED MYNEWT_VAL(BLE_MESH_BEACON_ENABLED)
562#define CONFIG_BT_MESH_FRIEND_ENABLED MYNEWT_VAL(BLE_MESH_FRIEND_ENABLED)
563#define CONFIG_BT_MESH_RELAY MYNEWT_VAL(BLE_MESH_RELAY)
564#define CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT MYNEWT_VAL(BLE_MESH_RELAY_RETRANSMIT_COUNT)
565#define CONFIG_BT_MESH_GATT_PROXY_ENABLED MYNEWT_VAL(BLE_MESH_GATT_PROXY_ENABLED)
566#define CONFIG_BT_MESH_PROXY_MSG_LEN MYNEWT_VAL(BLE_MESH_PROXY_MSG_LEN)
568#define printk console_printf
570#define CONTAINER_OF(ptr, type, field) \
571 ((type *)(((char *)(ptr)) - offsetof(type, field)))
574#define k_sem ble_npl_sem
576static inline void k_sem_init(
struct k_sem *sem,
unsigned int initial_count,
579 ble_npl_sem_init(sem, initial_count);
582static inline int k_sem_take(
struct k_sem *sem, int32_t timeout)
586 ble_npl_time_ms_to_ticks(timeout, &ticks);
587 return - ble_npl_sem_pend(sem, ticks);
590static inline void k_sem_give(
struct k_sem *sem)
592 ble_npl_sem_release(sem);
595static inline void k_sem_reset(
struct k_sem *sem)
597 ble_npl_sem_init(sem, 0);
603#define BUF_SIZE(pool) (pool->omp_pool->mp_block_size)
605static inline int net_buf_id(
struct os_mbuf *buf)
609 uint8_t *buf_ptr = (uint8_t *)buf;
611 return (buf_ptr - pool_start) / BUF_SIZE(pool);
620void net_buf_slist_init(
struct net_buf_slist_t *list);
621bool net_buf_slist_is_empty(
struct net_buf_slist_t *list);
622struct os_mbuf *net_buf_slist_peek_head(
struct net_buf_slist_t *list);
624struct os_mbuf *net_buf_slist_get(
struct net_buf_slist_t *list);
625void net_buf_slist_put(
struct net_buf_slist_t *list,
struct os_mbuf *buf);
626void net_buf_slist_remove(
struct net_buf_slist_t *list,
struct os_mbuf *prev,
628void net_buf_slist_merge_slist(
struct net_buf_slist_t *list,
629 struct net_buf_slist_t *list_to_append);
630#define NET_BUF_SLIST_FOR_EACH_NODE(head, var) STAILQ_FOREACH(var, head, omp_next)
632#if MYNEWT_VAL(BLE_MESH_SETTINGS)
634#define settings_load conf_load
635int settings_bytes_from_str(
char *val_str,
void *vp,
int *len);
636char *settings_str_from_bytes(
const void *vp,
int vp_len,
637 char *buf,
int buf_len);
639#define snprintk snprintf
640#define BT_SETTINGS_SIZE(in_size) ((((((in_size) - 1) / 3) * 4) + 4) + 1)
641#define settings_save_one conf_save_one
653#define BUILD_ASSERT(cond, msg) _Static_assert(cond, msg)
675struct k_mem_block_id {
683 struct k_mem_block_id id;
686extern void k_mem_slab_free(
struct k_mem_slab *slab,
void **mem);
687extern int k_mem_slab_alloc(
struct k_mem_slab *slab,
void **mem);
688static inline uint32_t k_mem_slab_num_free_get(
struct k_mem_slab *slab)
– Interface to an AES-128 implementation.
Interface to a CMAC implementation.
– Interface to constants.
– Interface to EC-DH implementation.
struct os_mbuf * os_msys_get(uint16_t dsize, uint16_t leadingspace)
Definition os_mbuf.c:176
Connection descriptor.
Definition ble_gap.h:249
uint32_t options
Definition glue.h:384
const bt_addr_le_t * peer
Directed advertising to peer.
Definition glue.h:419
uint8_t sid
Advertising Set Identifier, valid range 0x00 - 0x0f.
Definition glue.h:371
uint8_t secondary_max_skip
Secondary channel maximum skip count.
Definition glue.h:381
uint32_t interval_min
Definition glue.h:393
uint8_t id
Local identity.
Definition glue.h:364
uint32_t interval_max
Definition glue.h:402
char * buffer
Definition glue.h:670
uint32_t num_blocks
Definition glue.h:664
uint32_t num_used
Definition glue.h:672
size_t block_size
Definition glue.h:665
struct os_mempool * omp_pool
Definition os_mbuf.h:61
struct os_mbuf_pool * om_omp
Definition os_mbuf.h:107
uint8_t * om_data
Definition os_mbuf.h:90
uint8_t om_databuf[0]
Definition os_mbuf.h:114
uint16_t om_len
Definition os_mbuf.h:102
uint8_t om_pkthdr_len
Definition os_mbuf.h:98
uint32_t mp_membuf_addr
Definition os_mempool.h:69
Interface to platform-dependent run-time operations.