Lines Matching +full:specifier +full:- +full:space

8  * SPDX-License-Identifier: Apache-2.0
166 LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); in bt_sdp_connected()
168 k_fifo_init(&sdp->partial_resp_queue); in bt_sdp_connected()
187 LOG_DBG("chan %p cid 0x%04x", ch, ch->tx.cid); in bt_sdp_disconnected()
220 uint16_t param_len = buf->len; in bt_sdp_send()
224 hdr->op_code = op; in bt_sdp_send()
225 hdr->tid = sys_cpu_to_be16(tid); in bt_sdp_send()
226 hdr->param_len = sys_cpu_to_be16(param_len); in bt_sdp_send()
274 uint8_t size_field_len = 0U; /* Space used to accommodate the size */ in parse_data_elem()
276 if (buf->len < 1) { in parse_data_elem()
281 data_elem->type = net_buf_pull_u8(buf); in parse_data_elem()
283 switch (data_elem->type & BT_SDP_TYPE_DESC_MASK) { in parse_data_elem()
288 data_elem->data_size = BIT(data_elem->type & in parse_data_elem()
295 size_field_len = BIT((data_elem->type & BT_SDP_SIZE_DESC_MASK) - in parse_data_elem()
297 if (buf->len < size_field_len) { in parse_data_elem()
303 data_elem->data_size = net_buf_pull_u8(buf); in parse_data_elem()
306 data_elem->data_size = net_buf_pull_be16(buf); in parse_data_elem()
309 data_elem->data_size = net_buf_pull_be32(buf); in parse_data_elem()
321 if (buf->len < data_elem->data_size) { in parse_data_elem()
326 data_elem->total_size = data_elem->data_size + size_field_len + 1; in parse_data_elem()
327 data_elem->data = buf->data; in parse_data_elem()
338 * @param elem Attribute to be used as the search space (haystack)
368 seq_size = elem->data_size; in search_uuid()
369 cur_elem = elem->data; in search_uuid()
371 if ((elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_UUID_UNSPEC) { in search_uuid()
396 if ((elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_SEQ_UNSPEC || in search_uuid()
397 (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_ALT_UNSPEC) { in search_uuid()
406 seq_size -= size; in search_uuid()
410 return elem->total_size; in search_uuid()
433 rec = rec->next; in bt_sdp_foreach_svc()
451 rec_list[rec->index] = rec; in insert_record()
513 if (buf->len < data_elem.data_size) { in find_services()
526 sys_memcpy_swap(u.u128.val, buf->data, in find_services()
535 uuid_list_size -= data_elem.total_size; in find_services()
550 for (att_idx = 0U; att_idx < record->attr_count; in find_services()
552 search_uuid(&record->attrs[att_idx].val, in find_services()
598 if (buf->len < 3) { in sdp_svc_search_req()
627 if (buf->len < cont_state_size) { in sdp_svc_search_req()
662 if ((MIN(SDP_MTU, sdp->chan.tx.mtu) - resp_buf->len) < in sdp_svc_search_req()
674 * continue dry-running to calculate total_recs. in sdp_svc_search_req()
685 net_buf_add_be32(resp_buf, record->handle); in sdp_svc_search_req()
696 rsp->total_recs = sys_cpu_to_be16(total_recs); in sdp_svc_search_req()
697 rsp->current_recs = sys_cpu_to_be16(current_recs); in sdp_svc_search_req()
699 LOG_DBG("Sending response, len %u", resp_buf->len); in sdp_svc_search_req()
700 bt_sdp_send(&sdp->chan.chan, resp_buf, BT_SDP_SVC_SEARCH_RSP, tid); in sdp_svc_search_req()
727 seq_size = elem->data_size; in copy_attribute()
728 total_size = elem->total_size; in copy_attribute()
729 cur_elem = elem->data; in copy_attribute()
732 net_buf_add_u8(buf, elem->type); in copy_attribute()
734 switch (total_size - (seq_size + 1U)) { in copy_attribute()
736 net_buf_add_u8(buf, elem->data_size); in copy_attribute()
739 net_buf_add_be16(buf, elem->data_size); in copy_attribute()
742 net_buf_add_be32(buf, elem->data_size); in copy_attribute()
749 if ((elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_SEQ_UNSPEC || in copy_attribute()
750 (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_ALT_UNSPEC) { in copy_attribute()
755 seq_size -= size; in copy_attribute()
757 } else if ((elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_UINT8 || in copy_attribute()
758 (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_INT8 || in copy_attribute()
759 (elem->type & BT_SDP_TYPE_DESC_MASK) == BT_SDP_UUID_UNSPEC) { in copy_attribute()
761 net_buf_add_u8(buf, *((uint8_t *)elem->data)); in copy_attribute()
763 net_buf_add_be16(buf, *((uint16_t *)elem->data)); in copy_attribute()
765 net_buf_add_be32(buf, *((uint32_t *)elem->data)); in copy_attribute()
767 /* TODO: Convert 32bit and 128bit values to big-endian*/ in copy_attribute()
768 net_buf_add_mem(buf, elem->data, seq_size); in copy_attribute()
771 net_buf_add_mem(buf, elem->data, seq_size); in copy_attribute()
791 for (; idx < record->attr_count; idx++) { in bt_sdp_foreach_attr()
792 if (func(&record->attrs[idx], idx, user_data) == in bt_sdp_foreach_attr()
818 uint16_t att_id_lower, att_id_upper, att_id_cur, space; in select_attrs() local
822 for (idx_filter = 0U; idx_filter < sad->num_filters; idx_filter++) { in select_attrs()
824 att_id_lower = (sad->filter[idx_filter] >> 16); in select_attrs()
825 att_id_upper = (sad->filter[idx_filter]); in select_attrs()
826 att_id_cur = attr->id; in select_attrs()
842 attr_size = 3 + attr->val.total_size; in select_attrs()
845 * to account for the space required to add the per-service in select_attrs()
848 if ((sad->state->current_svc != sad->rec->index) && in select_attrs()
849 sad->new_service) { in select_attrs()
850 /* 3 bytes for Per-Service Data Elem Seq declaration */ in select_attrs()
856 if (sad->rsp_buf) { in select_attrs()
857 space = MIN(SDP_MTU, sad->sdp->chan.tx.mtu) - in select_attrs()
858 sad->rsp_buf->len - sizeof(struct bt_sdp_hdr); in select_attrs()
860 if ((!sad->state->pkt_full) && in select_attrs()
861 ((seq_size > sad->max_att_len) || in select_attrs()
862 (space < seq_size + sad->cont_state_size))) { in select_attrs()
864 sad->state->pkt_full = true; in select_attrs()
869 if (!sad->state->pkt_full && sad->rsp_buf) { in select_attrs()
870 /* Add Per-Service Data Element Seq declaration once in select_attrs()
873 if (!sad->seq && in select_attrs()
874 (sad->state->current_svc != sad->rec->index)) { in select_attrs()
875 sad->seq = net_buf_add(sad->rsp_buf, in select_attrs()
876 sizeof(*sad->seq)); in select_attrs()
877 sad->seq->type = BT_SDP_SEQ16; in select_attrs()
878 sad->seq->size = 0U; in select_attrs()
882 net_buf_add_u8(sad->rsp_buf, BT_SDP_UINT16); in select_attrs()
883 net_buf_add_be16(sad->rsp_buf, att_id_cur); in select_attrs()
886 copy_attribute(&attr->val, sad->rsp_buf, 1); in select_attrs()
888 sad->max_att_len -= seq_size; in select_attrs()
889 sad->att_list_len += seq_size; in select_attrs()
890 sad->state->last_att = att_idx; in select_attrs()
891 sad->state->current_svc = sad->rec->index; in select_attrs()
894 if (sad->seq) { in select_attrs()
896 * the Per-Service Data Element Seq declaration header in select_attrs()
898 sad->seq->size += attr_size; in select_attrs()
899 sad->state->att_list_size += seq_size; in select_attrs()
902 * It's a dry-run, calculating the total attr lists size in select_attrs()
904 sad->state->att_list_size += seq_size; in select_attrs()
907 sad->new_service = false; in select_attrs()
916 * 3. This is not a dry-run (then we look for other attrs that match) in select_attrs()
918 if (sad->state->pkt_full && !sad->seq && sad->rsp_buf) { in select_attrs()
937 * space for in the packet. This will vary based on the type of the request
968 sad.seq->size = sys_cpu_to_be16(sad.seq->size); in create_attr_list()
1020 if (buf->len < data_elem.data_size) { in get_att_search_list()
1036 size -= data_elem.total_size; in get_att_search_list()
1056 if (rec->handle == *svc_rec_hdl) { in find_handle()
1090 if (buf->len < 6) { in sdp_svc_att_req()
1105 if (buf->len < 1) { in sdp_svc_att_req()
1121 if (buf->len < cont_state_size) { in sdp_svc_att_req()
1143 state.current_svc = record->index; in sdp_svc_att_req()
1170 rsp->att_list_len = sys_cpu_to_be16(att_list_len); in sdp_svc_att_req()
1172 LOG_DBG("Sending response, len %u", rsp_buf->len); in sdp_svc_att_req()
1173 bt_sdp_send(&sdp->chan.chan, rsp_buf, BT_SDP_SVC_ATTR_RSP, tid); in sdp_svc_att_req()
1213 if (buf->len < 2) { in sdp_svc_search_att_req()
1228 if (buf->len < 1) { in sdp_svc_search_att_req()
1244 if (buf->len < cont_state_size) { in sdp_svc_search_att_req()
1265 seq->type = BT_SDP_SEQ16; in sdp_svc_search_att_req()
1266 seq->size = 0U; in sdp_svc_search_att_req()
1296 /* Break if it's not a partial response, else dry-run in sdp_svc_search_att_req()
1320 rsp->att_list_len = sys_cpu_to_be16(att_list_len); in sdp_svc_search_att_req()
1322 seq->size = sys_cpu_to_be16(state.att_list_size); in sdp_svc_search_att_req()
1325 LOG_DBG("Sending response, len %u", rsp_buf->len); in sdp_svc_search_att_req()
1326 bt_sdp_send(&sdp->chan.chan, rsp_buf, BT_SDP_SVC_SEARCH_ATTR_RSP, in sdp_svc_search_att_req()
1360 LOG_DBG("chan %p, ch %p, cid 0x%04x", chan, ch, ch->tx.cid); in bt_sdp_recv()
1364 if (buf->len < sizeof(*hdr)) { in bt_sdp_recv()
1370 LOG_DBG("Received SDP code 0x%02x len %u", hdr->op_code, buf->len); in bt_sdp_recv()
1372 if (sys_cpu_to_be16(hdr->param_len) != buf->len) { in bt_sdp_recv()
1376 if (hdr->op_code != handlers[i].op_code) { in bt_sdp_recv()
1380 err = handlers[i].func(sdp, buf, sys_be16_to_cpu(hdr->tid)); in bt_sdp_recv()
1387 send_err_rsp(chan, err, sys_be16_to_cpu(hdr->tid)); in bt_sdp_recv()
1418 if (sdp->chan.chan.conn) { in bt_sdp_accept()
1422 sdp->chan.chan.ops = &ops; in bt_sdp_accept()
1423 sdp->chan.rx.mtu = SDP_MTU; in bt_sdp_accept()
1425 *chan = &sdp->chan.chan; in bt_sdp_accept()
1432 return -ENOMEM; in bt_sdp_accept()
1461 return -ENOMEM; in bt_sdp_register_service()
1465 handle = db->handle + 1; in bt_sdp_register_service()
1468 service->next = db; in bt_sdp_register_service()
1469 service->index = num_services++; in bt_sdp_register_service()
1470 service->handle = handle; in bt_sdp_register_service()
1471 *((uint32_t *)(service->attrs[0].val.data)) = handle; in bt_sdp_register_service()
1493 switch (param->uuid->type) { in sdp_client_ss_search()
1500 net_buf_add_be16(buf, BT_UUID_16(param->uuid)->val); in sdp_client_ss_search()
1505 net_buf_add_be32(buf, BT_UUID_32(param->uuid)->val); in sdp_client_ss_search()
1510 net_buf_add_mem(buf, BT_UUID_128(param->uuid)->val, in sdp_client_ss_search()
1511 ARRAY_SIZE(BT_UUID_128(param->uuid)->val)); in sdp_client_ss_search()
1514 LOG_ERR("Unknown UUID type %u", param->uuid->type); in sdp_client_ss_search()
1515 return -EINVAL; in sdp_client_ss_search()
1519 net_buf_add_be16(buf, net_buf_tailroom(session->rec_buf) / SDP_RECORD_HANDLE_SIZE); in sdp_client_ss_search()
1526 if (session->cstate.length == 0U) { in sdp_client_ss_search()
1529 net_buf_add_u8(buf, session->cstate.length); in sdp_client_ss_search()
1530 net_buf_add_mem(buf, session->cstate.data, session->cstate.length); in sdp_client_ss_search()
1534 session->param = param; in sdp_client_ss_search()
1535 session->tid++; in sdp_client_ss_search()
1537 return bt_sdp_send(&session->chan.chan, buf, BT_SDP_SVC_SEARCH_REQ, session->tid); in sdp_client_ss_search()
1549 net_buf_add_be32(buf, param->handle); in sdp_client_sa_search()
1552 net_buf_add_be16(buf, net_buf_tailroom(session->rec_buf)); in sdp_client_sa_search()
1571 if (session->cstate.length == 0U) { in sdp_client_sa_search()
1574 net_buf_add_u8(buf, session->cstate.length); in sdp_client_sa_search()
1575 net_buf_add_mem(buf, session->cstate.data, session->cstate.length); in sdp_client_sa_search()
1579 session->param = param; in sdp_client_sa_search()
1580 session->tid++; in sdp_client_sa_search()
1582 return bt_sdp_send(&session->chan.chan, buf, BT_SDP_SVC_ATTR_REQ, session->tid); in sdp_client_sa_search()
1596 switch (param->uuid->type) { in sdp_client_ssa_search()
1603 net_buf_add_be16(buf, BT_UUID_16(param->uuid)->val); in sdp_client_ssa_search()
1608 net_buf_add_be32(buf, BT_UUID_32(param->uuid)->val); in sdp_client_ssa_search()
1613 net_buf_add_mem(buf, BT_UUID_128(param->uuid)->val, in sdp_client_ssa_search()
1614 ARRAY_SIZE(BT_UUID_128(param->uuid)->val)); in sdp_client_ssa_search()
1617 LOG_ERR("Unknown UUID type %u", param->uuid->type); in sdp_client_ssa_search()
1618 return -EINVAL; in sdp_client_ssa_search()
1622 net_buf_add_be16(buf, net_buf_tailroom(session->rec_buf)); in sdp_client_ssa_search()
1641 if (session->cstate.length == 0U) { in sdp_client_ssa_search()
1644 net_buf_add_u8(buf, session->cstate.length); in sdp_client_ssa_search()
1645 net_buf_add_mem(buf, session->cstate.data, in sdp_client_ssa_search()
1646 session->cstate.length); in sdp_client_ssa_search()
1650 session->param = param; in sdp_client_ssa_search()
1651 session->tid++; in sdp_client_ssa_search()
1653 return bt_sdp_send(&session->chan.chan, buf, BT_SDP_SVC_SEARCH_ATTR_REQ, in sdp_client_ssa_search()
1654 session->tid); in sdp_client_ssa_search()
1665 * Select proper user params, if session->param is invalid it means in sdp_client_discover()
1670 if (!session->param) { in sdp_client_discover()
1671 param = GET_PARAM(sys_slist_peek_head(&session->reqs)); in sdp_client_discover()
1673 param = session->param; in sdp_client_discover()
1677 struct bt_l2cap_chan *chan = &session->chan.chan; in sdp_client_discover()
1684 switch (param->type) { in sdp_client_discover()
1695 err = -EINVAL; in sdp_client_discover()
1709 struct bt_l2cap_chan *chan = &session->chan.chan; in sdp_client_params_iterator()
1712 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&session->reqs, param, tmp, _node) { in sdp_client_params_iterator()
1713 if (param != session->param) { in sdp_client_params_iterator()
1720 sys_slist_remove(&session->reqs, NULL, &param->_node); in sdp_client_params_iterator()
1722 session->param = NULL; in sdp_client_params_iterator()
1724 (void)memset(&session->cstate, 0, sizeof(session->cstate)); in sdp_client_params_iterator()
1727 if (!sys_slist_is_empty(&session->reqs)) { in sdp_client_params_iterator()
1751 if (session->cstate.length == 0U) { in sdp_client_get_total()
1784 if (buf->len >= SDP_RECORD_HANDLE_SIZE) { in get_ss_record_len()
1823 buf = session->rec_buf; in get_record_len()
1825 if (!session->param) { in get_record_len()
1826 return buf->len; in get_record_len()
1829 switch (session->param->type) { in get_record_len()
1838 len = buf->len; in get_record_len()
1855 struct bt_conn *conn = session->chan.chan.conn; in sdp_client_notify_result()
1863 session->param->func(conn, &result, session->param); in sdp_client_notify_result()
1867 while (session->rec_buf->len) { in sdp_client_notify_result()
1872 if (session->rec_buf->len > rec_len) { in sdp_client_notify_result()
1879 net_buf_simple_save(&session->rec_buf->b, &buf_state); in sdp_client_notify_result()
1881 result.resp_buf = session->rec_buf; in sdp_client_notify_result()
1887 result.resp_buf->len = rec_len; in sdp_client_notify_result()
1889 user_ret = session->param->func(conn, &result, session->param); in sdp_client_notify_result()
1892 net_buf_simple_restore(&session->rec_buf->b, &buf_state); in sdp_client_notify_result()
1897 net_buf_pull(session->rec_buf, rec_len); in sdp_client_notify_result()
1913 if (buf->len < sizeof(total_count)) { in sdp_client_receive_ss()
1922 if (buf->len < sizeof(current_count)) { in sdp_client_receive_ss()
1935 received_count = session->rec_buf->len / SDP_RECORD_HANDLE_SIZE; in sdp_client_receive_ss()
1942 if (record_len >= buf->len) { in sdp_client_receive_ss()
1948 cstate = (struct bt_sdp_pdu_cstate *)(buf->data + record_len); in sdp_client_receive_ss()
1950 if (cstate->length > BT_SDP_MAX_PDU_CSTATE_LEN) { in sdp_client_receive_ss()
1951 LOG_ERR("Invalid SDP PDU Continuation State length %u", cstate->length); in sdp_client_receive_ss()
1955 if ((record_len + SDP_CONT_STATE_LEN_SIZE + cstate->length) > buf->len) { in sdp_client_receive_ss()
1965 if (!current_count && cstate->length == 0U && session->cstate.length == 0U) { in sdp_client_receive_ss()
1966 LOG_DBG("Service record handle 0x%x not found", session->param->handle); in sdp_client_receive_ss()
1969 net_buf_pull(buf, sizeof(cstate->length)); in sdp_client_receive_ss()
1973 if (record_len > net_buf_tailroom(session->rec_buf)) { in sdp_client_receive_ss()
1978 net_buf_add_mem(session->rec_buf, buf->data, record_len); in sdp_client_receive_ss()
1982 if (cstate->length) { in sdp_client_receive_ss()
1984 memcpy(&session->cstate, cstate, sizeof(struct bt_sdp_pdu_cstate)); in sdp_client_receive_ss()
1986 net_buf_pull(buf, cstate->length + sizeof(cstate->length)); in sdp_client_receive_ss()
1992 net_buf_pull(buf, sizeof(cstate->length)); in sdp_client_receive_ss()
1994 LOG_DBG("UUID 0x%s resolved", bt_uuid_str(session->param->uuid)); in sdp_client_receive_ss()
2010 if (buf->len < sizeof(frame_len)) { in sdp_client_receive_ssa_sa()
2018 if (buf->len < frame_len + SDP_CONT_STATE_LEN_SIZE) { in sdp_client_receive_ssa_sa()
2029 cstate = (struct bt_sdp_pdu_cstate *)(buf->data + frame_len); in sdp_client_receive_ssa_sa()
2031 if (cstate->length > BT_SDP_MAX_PDU_CSTATE_LEN) { in sdp_client_receive_ssa_sa()
2032 LOG_ERR("Invalid SDP PDU Continuation State length %u", cstate->length); in sdp_client_receive_ssa_sa()
2036 if ((frame_len + SDP_CONT_STATE_LEN_SIZE + cstate->length) > buf->len) { in sdp_client_receive_ssa_sa()
2046 if (frame_len == 2U && cstate->length == 0U && session->cstate.length == 0U) { in sdp_client_receive_ssa_sa()
2047 LOG_DBG("Record for UUID 0x%s not found", bt_uuid_str(session->param->uuid)); in sdp_client_receive_ssa_sa()
2050 net_buf_pull(buf, frame_len + sizeof(cstate->length)); in sdp_client_receive_ssa_sa()
2055 frame_len -= sdp_client_get_total(session, buf, &total); in sdp_client_receive_ssa_sa()
2057 if (total > net_buf_tailroom(session->rec_buf)) { in sdp_client_receive_ssa_sa()
2062 net_buf_add_mem(session->rec_buf, buf->data, frame_len); in sdp_client_receive_ssa_sa()
2066 if (cstate->length) { in sdp_client_receive_ssa_sa()
2068 memcpy(&session->cstate, cstate, sizeof(struct bt_sdp_pdu_cstate)); in sdp_client_receive_ssa_sa()
2070 net_buf_pull(buf, cstate->length + sizeof(cstate->length)); in sdp_client_receive_ssa_sa()
2076 net_buf_pull(buf, sizeof(cstate->length)); in sdp_client_receive_ssa_sa()
2078 LOG_DBG("UUID 0x%s resolved", bt_uuid_str(session->param->uuid)); in sdp_client_receive_ssa_sa()
2095 if (buf->len < sizeof(*hdr)) { in sdp_client_receive()
2101 len = sys_be16_to_cpu(hdr->param_len); in sdp_client_receive()
2102 tid = sys_be16_to_cpu(hdr->tid); in sdp_client_receive()
2106 if (buf->len != len) { in sdp_client_receive()
2107 LOG_ERR("SDP PDU length mismatch (%u != %u)", buf->len, len); in sdp_client_receive()
2111 if (tid != session->tid) { in sdp_client_receive()
2116 switch (hdr->op_code) { in sdp_client_receive()
2129 LOG_DBG("PDU 0x%0x response not handled", hdr->op_code); in sdp_client_receive()
2138 return bt_l2cap_br_chan_connect(session->chan.chan.conn, &session->chan.chan, SDP_PSM); in sdp_client_chan_connect()
2148 session->param = GET_PARAM(sys_slist_peek_head(&session->reqs)); in sdp_client_alloc_buf()
2150 buf = net_buf_alloc(session->param->pool, K_FOREVER); in sdp_client_alloc_buf()
2162 session->rec_buf = chan->ops->alloc_buf(chan); in sdp_client_connected()
2163 if (!session->rec_buf) { in sdp_client_connected()
2177 if (session->rec_buf) { in sdp_client_disconnected()
2178 net_buf_unref(session->rec_buf); in sdp_client_disconnected()
2185 (void)memset(&session->reqs, 0, in sdp_client_disconnected()
2186 sizeof(*session) - sizeof(session->chan)); in sdp_client_disconnected()
2204 if (session->chan.chan.conn) { in sdp_client_new_session()
2208 sys_slist_init(&session->reqs); in sdp_client_new_session()
2210 session->chan.chan.ops = &sdp_client_chan_ops; in sdp_client_new_session()
2211 session->chan.chan.conn = conn; in sdp_client_new_session()
2212 session->chan.rx.mtu = SDP_CLIENT_MTU; in sdp_client_new_session()
2251 if (!params || !params->uuid || !params->func || !params->pool) { in bt_sdp_discover()
2253 return -EINVAL; in bt_sdp_discover()
2258 return -ENOMEM; in bt_sdp_discover()
2261 sys_slist_append(&session->reqs, (sys_snode_t *)&params->_node); in bt_sdp_discover()
2307 return -EINVAL; in sdp_get_int_len()
2311 return -EMSGSIZE; in sdp_get_int_len()
2335 return -EINVAL; in sdp_get_uuid_len()
2339 return -EMSGSIZE; in sdp_get_uuid_len()
2380 return -EINVAL; in sdp_get_str_len()
2384 return -EMSGSIZE; in sdp_get_str_len()
2425 return -EINVAL; in sdp_get_seq_len()
2429 return -EMSGSIZE; in sdp_get_seq_len()
2477 return -EINVAL; in sdp_get_attr_value_len()
2481 return -EMSGSIZE; in sdp_get_attr_value_len()
2515 data = buf->data; in bt_sdp_get_attr()
2516 while (data - buf->data < buf->len) { in bt_sdp_get_attr()
2522 return -EINVAL; in bt_sdp_get_attr()
2526 if ((data + sizeof(id) - buf->data) > buf->len) { in bt_sdp_get_attr()
2527 return -EINVAL; in bt_sdp_get_attr()
2534 buf->len - (data - buf->data)); in bt_sdp_get_attr()
2537 return -EINVAL; in bt_sdp_get_attr()
2546 attr->val = data; in bt_sdp_get_attr()
2547 attr->len = dlen; in bt_sdp_get_attr()
2548 attr->attr_id = id; in bt_sdp_get_attr()
2555 return -ENOENT; in bt_sdp_get_attr()
2607 return -EINVAL; in sdp_get_seq_len_item()
2611 return -EMSGSIZE; in sdp_get_seq_len_item()
2621 return -EMSGSIZE; in sdp_loop_seqs()
2624 pre_slen = -EINVAL; in sdp_loop_seqs()
2625 slen = -EINVAL; in sdp_loop_seqs()
2630 slen = sdp_get_seq_len_item(data, end - *data); in sdp_loop_seqs()
2651 uint8_t *p = attr->val; in sdp_get_uuid_data()
2657 while (p - attr->val < attr->len) { in sdp_get_uuid_data()
2662 to_end = attr->len - (p - attr->val); in sdp_get_uuid_data()
2675 return -EMSGSIZE; in sdp_get_uuid_data()
2682 left -= sizeof(dtd); in sdp_get_uuid_data()
2685 memcpy(&pd->uuid16, in sdp_get_uuid_data()
2689 left -= sizeof(uint16_t); in sdp_get_uuid_data()
2694 return -EMSGSIZE; in sdp_get_uuid_data()
2697 memcpy(&pd->uuid32, in sdp_get_uuid_data()
2701 left -= sizeof(BT_UUID_SIZE_32); in sdp_get_uuid_data()
2705 return -EINVAL; in sdp_get_uuid_data()
2712 if ((proto_profile == BT_UUID_16(&pd->uuid)->val) || in sdp_get_uuid_data()
2713 (proto_profile == BT_UUID_32(&pd->uuid)->val)) { in sdp_get_uuid_data()
2714 pd->params = p; in sdp_get_uuid_data()
2715 pd->params_len = left; in sdp_get_uuid_data()
2717 LOG_DBG("UUID 0x%s found", bt_uuid_str(&pd->uuid)); in sdp_get_uuid_data()
2719 proto_profile_index--; in sdp_get_uuid_data()
2732 return -ENOENT; in sdp_get_uuid_data()
2741 const uint8_t *p = pd_item->params; in sdp_get_param_item()
2746 LOG_DBG("Getting UUID's 0x%s params", bt_uuid_str(&pd_item->uuid)); in sdp_get_param_item()
2751 if (pd_item->params_len < 2) { in sdp_get_param_item()
2760 if (pd_item->params_len < 3) { in sdp_get_param_item()
2769 if (pd_item->params_len < 5) { in sdp_get_param_item()
2778 return -EINVAL; in sdp_get_param_item()
2784 if (p - pd_item->params != pd_item->params_len || len_err) { in sdp_get_param_item()
2786 return -EMSGSIZE; in sdp_get_param_item()
2800 LOG_ERR("Invalid protocol specifier"); in bt_sdp_get_proto_param()
2801 return -EINVAL; in bt_sdp_get_proto_param()
2812 LOG_WRN("Protocol specifier 0x%04x not found, err %d", proto, res); in bt_sdp_get_proto_param()
2827 LOG_ERR("Invalid protocol specifier"); in bt_sdp_get_addl_proto_param()
2828 return -EINVAL; in bt_sdp_get_addl_proto_param()
2839 LOG_WRN("Protocol specifier 0x%04x not found, err %d", proto, res); in bt_sdp_get_addl_proto_param()
2885 return -EINVAL; in bt_sdp_get_features()
2891 return -EMSGSIZE; in bt_sdp_get_features()
2897 if (p - attr.val != attr.len) { in bt_sdp_get_features()
2899 return -EMSGSIZE; in bt_sdp_get_features()