Home | History | Annotate | Download | only in sdp

Lines Matching full:p_ccb

49 static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
51 static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
53 static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
55 static uint8_t* save_attr_seq(tCONN_CB* p_ccb, uint8_t* p, uint8_t* p_msg_end);
122 static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len,
134 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id);
135 p_ccb->transaction_id++;
144 &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]);
146 p = sdpu_build_uuid_seq(p, p_ccb->p_db->num_uuid_filters,
147 p_ccb->p_db->uuid_filters);
166 p_ccb->disc_state = SDP_DISC_WAIT_HANDLES;
173 cont_len, p_ccb->disc_state);
176 L2CA_DataWrite(p_ccb->connection_id, p_cmd);
179 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
180 sdp_conn_timer_timeout, p_ccb);
193 void sdp_disc_connected(tCONN_CB* p_ccb) {
194 if (p_ccb->is_attr_search) {
195 p_ccb->disc_state = SDP_DISC_WAIT_SEARCH_ATTR;
197 process_service_search_attr_rsp(p_ccb, NULL, NULL);
203 p_ccb->num_handles = 0;
204 sdp_snd_service_search_req(p_ccb, 0, NULL);
218 void sdp_disc_server_rsp(tCONN_CB* p_ccb, BT_HDR* p_msg) {
223 SDP_TRACE_WARNING("sdp_disc_server_rsp disc_state:%d", p_ccb->disc_state);
227 alarm_cancel(p_ccb->sdp_conn_timer);
239 if (p_ccb->disc_state == SDP_DISC_WAIT_HANDLES) {
240 process_service_search_rsp(p_ccb, p, p_end);
246 if (p_ccb->disc_state == SDP_DISC_WAIT_ATTR) {
247 process_service_attr_rsp(p_ccb, p, p_end);
253 if (p_ccb->disc_state == SDP_DISC_WAIT_SEARCH_ATTR) {
254 process_service_search_attr_rsp(p_ccb, p, p_end);
262 p_ccb->disc_state);
263 sdp_disconnect(p_ccb, SDP_GENERIC_ERROR);
277 static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
288 orig = p_ccb->num_handles;
289 p_ccb->num_handles += cur_handles;
290 if (p_ccb->num_handles == 0) {
292 sdp_disconnect(p_ccb, SDP_NO_RECS_MATCH);
298 if (p_ccb->num_handles > sdp_cb.max_recs_per_search)
299 p_ccb->num_handles = sdp_cb.max_recs_per_search;
301 for (xx = orig; xx < p_ccb->num_handles; xx++)
302 BE_STREAM_TO_UINT32(p_ccb->handles[xx], p_reply);
307 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE);
312 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE);
316 sdp_snd_service_search_req(p_ccb, cont_len, p_reply);
319 p_ccb->disc_state = SDP_DISC_WAIT_ATTR;
322 process_service_attr_rsp(p_ccb, NULL, NULL);
337 static void sdp_copy_raw_data(tCONN_CB* p_ccb, bool offset) {
347 for (i = 0; i < p_ccb->list_len; i++) {
349 (uint8_t)(p_ccb->rsp_list[i]));
354 if (p_ccb->p_db->raw_data) {
355 cpy_len = p_ccb->p_db->raw_size - p_ccb->p_db->raw_used;
356 list_len = p_ccb->list_len;
357 p = &p_ccb->rsp_list[0];
366 rem_len = SDP_MAX_LIST_BYTE_COUNT - (unsigned int)(p - &p_ccb->rsp_list[0]);
372 "%s: list_len:%d cpy_len:%d p:%p p_ccb:%p p_db:%p raw_size:%d "
374 __func__, list_len, cpy_len, p, p_ccb, p_ccb->p_db,
375 p_ccb->p_db->raw_size, p_ccb->p_db->raw_used, p_ccb->p_db->raw_data);
376 memcpy(&p_ccb->p_db->raw_data[p_ccb->p_db->raw_used], p, cpy_len);
377 p_ccb->p_db->raw_used += cpy_len;
392 static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
418 if ((p_ccb->list_len + list_byte_count) > SDP_MAX_LIST_BYTE_COUNT) {
419 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE);
424 SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d", p_ccb->list_len,
427 if (p_ccb->rsp_list == NULL)
428 p_ccb->rsp_list = (uint8_t*)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
429 memcpy(&p_ccb->rsp_list[p_ccb->list_len], p_reply, list_byte_count);
430 p_ccb->list_len += list_byte_count;
433 SDP_TRACE_WARNING("list_len: %d(attr_rsp)", p_ccb->list_len);
440 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE);
447 sdp_copy_raw_data(p_ccb, false);
451 if (!save_attr_seq(p_ccb, &p_ccb->rsp_list[0],
452 &p_ccb->rsp_list[p_ccb->list_len])) {
453 sdp_disconnect(p_ccb, SDP_DB_FULL);
456 p_ccb->list_len = 0;
457 p_ccb->cur_handle++;
462 if (p_ccb->cur_handle < p_ccb->num_handles) {
471 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id);
472 p_ccb->transaction_id++;
478 UINT32_TO_BE_STREAM(p, p_ccb->handles[p_ccb->cur_handle]);
484 if (p_ccb->p_db->num_attr_filters)
485 p = sdpu_build_attrib_seq(p, p_ccb->p_db->attr_filters,
486 p_ccb->p_db->num_attr_filters);
508 L2CA_DataWrite(p_ccb->connection_id, p_msg);
511 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
512 sdp_conn_timer_timeout, p_ccb);
514 sdp_disconnect(p_ccb, SDP_SUCCESS);
529 static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
545 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE);
563 if ((p_ccb->list_len + lists_byte_count) > SDP_MAX_LIST_BYTE_COUNT) {
564 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE);
569 SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d", p_ccb->list_len,
575 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE);
579 if (p_ccb->rsp_list == NULL)
580 p_ccb->rsp_list = (uint8_t*)osi_malloc(SDP_MAX_LIST_BYTE_COUNT);
581 memcpy(&p_ccb->rsp_list[p_ccb->list_len], p_reply, lists_byte_count);
582 p_ccb->list_len += lists_byte_count;
585 SDP_TRACE_WARNING("list_len: %d(search_attr_rsp)", p_ccb->list_len);
592 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE);
613 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id);
614 p_ccb->transaction_id++;
623 &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]);
625 p = sdpu_build_uuid_seq(p, p_ccb->p_db->num_uuid_filters,
626 p_ccb->p_db->uuid_filters);
633 if (p_ccb->p_db->num_attr_filters)
634 p = sdpu_build_attrib_seq(p, p_ccb->p_db->attr_filters,
635 p_ccb->p_db->num_attr_filters);
657 L2CA_DataWrite(p_ccb->connection_id, p_msg);
660 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
661 sdp_conn_timer_timeout, p_ccb);
672 sdp_copy_raw_data(p_ccb, true);
675 p = &p_ccb->rsp_list[0];
686 p_end = &p_ccb->rsp_list[p_ccb->list_len];
689 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE);
694 p = save_attr_seq(p_ccb, p, &p_ccb->rsp_list[p_ccb->list_len]);
696 sdp_disconnect(p_ccb, SDP_DB_FULL);
702 sdp_disconnect(p_ccb, SDP_SUCCESS);
715 static uint8_t* save_attr_seq(tCONN_CB* p_ccb, uint8_t* p, uint8_t* p_msg_end) {
735 p_rec = add_record(p_ccb->p_db, p_ccb->device_address);
755 p = add_attr(p, p_ccb->p_db, p_rec, attr_id, NULL, 0);