Lines Matching full:net_buf
23 #include <zephyr/net_buf.h>
51 static uint32_t base_pull_pd(struct net_buf_simple *net_buf) in base_pull_pd() argument
53 return net_buf_simple_pull_le24(net_buf); in base_pull_pd()
56 static uint8_t base_pull_bis_count(struct net_buf_simple *net_buf) in base_pull_bis_count() argument
58 return net_buf_simple_pull_u8(net_buf); in base_pull_bis_count()
61 static void base_pull_codec_id(struct net_buf_simple *net_buf, in base_pull_codec_id() argument
66 codec.id = net_buf_simple_pull_u8(net_buf); /* coding format */ in base_pull_codec_id()
67 codec.cid = net_buf_simple_pull_le16(net_buf); /* company id */ in base_pull_codec_id()
68 codec.vid = net_buf_simple_pull_le16(net_buf); /* VS codec id */ in base_pull_codec_id()
75 static uint8_t base_pull_ltv(struct net_buf_simple *net_buf, uint8_t **data) in base_pull_ltv() argument
77 const uint8_t len = net_buf_simple_pull_u8(net_buf); in base_pull_ltv()
80 net_buf_simple_pull_mem(net_buf, len); in base_pull_ltv()
82 *data = net_buf_simple_pull_mem(net_buf, len); in base_pull_ltv()
88 static bool check_pull_ltv(struct net_buf_simple *net_buf) in check_pull_ltv() argument
92 if (net_buf->len < sizeof(ltv_len)) { in check_pull_ltv()
96 ltv_len = net_buf_simple_pull_u8(net_buf); in check_pull_ltv()
97 if (net_buf->len < ltv_len) { in check_pull_ltv()
100 net_buf_simple_pull_mem(net_buf, ltv_len); in check_pull_ltv()
109 struct net_buf_simple net_buf; in bt_bap_base_get_base_from_ad() local
131 net_buf_simple_init_with_data(&net_buf, (void *)ad->data, ad->data_len); in bt_bap_base_get_base_from_ad()
133 uuid = net_buf_simple_pull_mem(&net_buf, BT_UUID_SIZE_16); in bt_bap_base_get_base_from_ad()
147 base = (const struct bt_bap_base *)net_buf.data; in bt_bap_base_get_base_from_ad()
150 base_pull_pd(&net_buf); in bt_bap_base_get_base_from_ad()
151 subgroup_count = net_buf_simple_pull_u8(&net_buf); in bt_bap_base_get_base_from_ad()
161 if (net_buf.len < sizeof(bis_count)) { in bt_bap_base_get_base_from_ad()
167 bis_count = base_pull_bis_count(&net_buf); in bt_bap_base_get_base_from_ad()
174 if (net_buf.len < BASE_CODEC_ID_SIZE) { in bt_bap_base_get_base_from_ad()
180 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_get_base_from_ad()
183 if (!check_pull_ltv(&net_buf)) { in bt_bap_base_get_base_from_ad()
190 if (!check_pull_ltv(&net_buf)) { in bt_bap_base_get_base_from_ad()
199 if (net_buf.len < sizeof(bis_index)) { in bt_bap_base_get_base_from_ad()
205 bis_index = net_buf_simple_pull_u8(&net_buf); in bt_bap_base_get_base_from_ad()
213 if (!check_pull_ltv(&net_buf)) { in bt_bap_base_get_base_from_ad()
226 struct net_buf_simple net_buf; in bt_bap_base_get_size() local
236 net_buf_simple_init_with_data(&net_buf, (void *)base, BASE_MAX_SIZE); in bt_bap_base_get_size()
237 base_pull_pd(&net_buf); in bt_bap_base_get_size()
239 subgroup_count = net_buf_simple_pull_u8(&net_buf); in bt_bap_base_get_size()
247 bis_count = base_pull_bis_count(&net_buf); in bt_bap_base_get_size()
250 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_get_size()
254 len = base_pull_ltv(&net_buf, NULL); in bt_bap_base_get_size()
258 len = base_pull_ltv(&net_buf, NULL); in bt_bap_base_get_size()
264 net_buf_simple_pull_u8(&net_buf); in bt_bap_base_get_size()
268 len = base_pull_ltv(&net_buf, NULL); in bt_bap_base_get_size()
278 struct net_buf_simple net_buf; in bt_bap_base_get_pres_delay() local
287 net_buf_simple_init_with_data(&net_buf, (void *)base, sizeof(pd)); in bt_bap_base_get_pres_delay()
288 pd = base_pull_pd(&net_buf); in bt_bap_base_get_pres_delay()
295 struct net_buf_simple net_buf; in bt_bap_base_get_subgroup_count() local
304 net_buf_simple_init_with_data(&net_buf, (void *)base, BASE_MAX_SIZE); in bt_bap_base_get_subgroup_count()
305 base_pull_pd(&net_buf); in bt_bap_base_get_subgroup_count()
306 subgroup_count = net_buf_simple_pull_u8(&net_buf); in bt_bap_base_get_subgroup_count()
317 struct net_buf_simple net_buf; in bt_bap_base_foreach_subgroup() local
332 net_buf_simple_init_with_data(&net_buf, (void *)base, BASE_MAX_SIZE); in bt_bap_base_foreach_subgroup()
333 base_pull_pd(&net_buf); in bt_bap_base_foreach_subgroup()
334 subgroup_count = net_buf_simple_pull_u8(&net_buf); in bt_bap_base_foreach_subgroup()
337 subgroup = (struct bt_bap_base_subgroup *)net_buf.data; in bt_bap_base_foreach_subgroup()
348 bis_count = base_pull_bis_count(&net_buf); in bt_bap_base_foreach_subgroup()
349 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_foreach_subgroup()
352 base_pull_ltv(&net_buf, NULL); in bt_bap_base_foreach_subgroup()
355 base_pull_ltv(&net_buf, NULL); in bt_bap_base_foreach_subgroup()
358 net_buf_simple_pull_u8(&net_buf); /* index */ in bt_bap_base_foreach_subgroup()
361 base_pull_ltv(&net_buf, NULL); in bt_bap_base_foreach_subgroup()
372 struct net_buf_simple net_buf; in bt_bap_base_get_subgroup_codec_id() local
386 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_get_subgroup_codec_id()
387 base_pull_bis_count(&net_buf); in bt_bap_base_get_subgroup_codec_id()
388 base_pull_codec_id(&net_buf, codec_id); in bt_bap_base_get_subgroup_codec_id()
395 struct net_buf_simple net_buf; in bt_bap_base_get_subgroup_codec_data() local
409 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_get_subgroup_codec_data()
410 base_pull_bis_count(&net_buf); in bt_bap_base_get_subgroup_codec_data()
411 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_get_subgroup_codec_data()
414 return base_pull_ltv(&net_buf, data); in bt_bap_base_get_subgroup_codec_data()
419 struct net_buf_simple net_buf; in bt_bap_base_get_subgroup_codec_meta() local
433 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_get_subgroup_codec_meta()
434 base_pull_bis_count(&net_buf); in bt_bap_base_get_subgroup_codec_meta()
435 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_get_subgroup_codec_meta()
438 base_pull_ltv(&net_buf, NULL); in bt_bap_base_get_subgroup_codec_meta()
441 return base_pull_ltv(&net_buf, meta); in bt_bap_base_get_subgroup_codec_meta()
448 struct net_buf_simple net_buf; in bt_bap_base_subgroup_codec_to_codec_cfg() local
464 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_subgroup_codec_to_codec_cfg()
465 base_pull_bis_count(&net_buf); in bt_bap_base_subgroup_codec_to_codec_cfg()
466 base_pull_codec_id(&net_buf, &codec_id); in bt_bap_base_subgroup_codec_to_codec_cfg()
473 ltv_len = base_pull_ltv(&net_buf, <v_data); in bt_bap_base_subgroup_codec_to_codec_cfg()
486 ltv_len = base_pull_ltv(&net_buf, <v_data); in bt_bap_base_subgroup_codec_to_codec_cfg()
502 struct net_buf_simple net_buf; in bt_bap_base_get_subgroup_bis_count() local
510 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_get_subgroup_bis_count()
512 return base_pull_bis_count(&net_buf); in bt_bap_base_get_subgroup_bis_count()
520 struct net_buf_simple net_buf; in bt_bap_base_subgroup_foreach_bis() local
535 net_buf_simple_init_with_data(&net_buf, (void *)subgroup, BASE_SUBGROUP_MAX_SIZE); in bt_bap_base_subgroup_foreach_bis()
537 bis_count = base_pull_bis_count(&net_buf); in bt_bap_base_subgroup_foreach_bis()
538 base_pull_codec_id(&net_buf, NULL); in bt_bap_base_subgroup_foreach_bis()
541 base_pull_ltv(&net_buf, NULL); in bt_bap_base_subgroup_foreach_bis()
544 base_pull_ltv(&net_buf, NULL); in bt_bap_base_subgroup_foreach_bis()
549 bis.index = net_buf_simple_pull_u8(&net_buf); /* index */ in bt_bap_base_subgroup_foreach_bis()
552 bis.data_len = base_pull_ltv(&net_buf, &bis.data); in bt_bap_base_subgroup_foreach_bis()