• Home
  • Raw
  • Download

Lines Matching refs:p_ccb

45 static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
47 static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
49 static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply,
51 static uint8_t* save_attr_seq(tCONN_CB* p_ccb, uint8_t* p, uint8_t* p_msg_end);
118 static void sdp_snd_service_search_req(tCONN_CB* p_ccb, uint8_t cont_len, in sdp_snd_service_search_req() argument
130 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id); in sdp_snd_service_search_req()
131 p_ccb->transaction_id++; in sdp_snd_service_search_req()
140 &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]); in sdp_snd_service_search_req()
142 p = sdpu_build_uuid_seq(p, p_ccb->p_db->num_uuid_filters, in sdp_snd_service_search_req()
143 p_ccb->p_db->uuid_filters); in sdp_snd_service_search_req()
162 p_ccb->disc_state = SDP_DISC_WAIT_HANDLES; in sdp_snd_service_search_req()
167 L2CA_DataWrite(p_ccb->connection_id, p_cmd); in sdp_snd_service_search_req()
170 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS, in sdp_snd_service_search_req()
171 sdp_conn_timer_timeout, p_ccb); in sdp_snd_service_search_req()
184 void sdp_disc_connected(tCONN_CB* p_ccb) { in sdp_disc_connected() argument
185 if (p_ccb->is_attr_search) { in sdp_disc_connected()
186 p_ccb->disc_state = SDP_DISC_WAIT_SEARCH_ATTR; in sdp_disc_connected()
188 process_service_search_attr_rsp(p_ccb, NULL, NULL); in sdp_disc_connected()
194 p_ccb->num_handles = 0; in sdp_disc_connected()
195 sdp_snd_service_search_req(p_ccb, 0, NULL); in sdp_disc_connected()
209 void sdp_disc_server_rsp(tCONN_CB* p_ccb, BT_HDR* p_msg) { in sdp_disc_server_rsp() argument
214 alarm_cancel(p_ccb->sdp_conn_timer); in sdp_disc_server_rsp()
222 sdp_disconnect(p_ccb, SDP_GENERIC_ERROR); in sdp_disc_server_rsp()
232 if (p_ccb->disc_state == SDP_DISC_WAIT_HANDLES) { in sdp_disc_server_rsp()
233 process_service_search_rsp(p_ccb, p, p_end); in sdp_disc_server_rsp()
239 if (p_ccb->disc_state == SDP_DISC_WAIT_ATTR) { in sdp_disc_server_rsp()
240 process_service_attr_rsp(p_ccb, p, p_end); in sdp_disc_server_rsp()
246 if (p_ccb->disc_state == SDP_DISC_WAIT_SEARCH_ATTR) { in sdp_disc_server_rsp()
247 process_service_search_attr_rsp(p_ccb, p, p_end); in sdp_disc_server_rsp()
255 p_ccb->disc_state); in sdp_disc_server_rsp()
256 sdp_disconnect(p_ccb, SDP_GENERIC_ERROR); in sdp_disc_server_rsp()
270 static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, in process_service_search_rsp() argument
278 sdp_disconnect(p_ccb, SDP_GENERIC_ERROR); in process_service_search_rsp()
286 orig = p_ccb->num_handles; in process_service_search_rsp()
287 p_ccb->num_handles += cur_handles; in process_service_search_rsp()
288 if (p_ccb->num_handles == 0) { in process_service_search_rsp()
290 sdp_disconnect(p_ccb, SDP_NO_RECS_MATCH); in process_service_search_rsp()
296 if (p_ccb->num_handles > sdp_cb.max_recs_per_search) in process_service_search_rsp()
297 p_ccb->num_handles = sdp_cb.max_recs_per_search; in process_service_search_rsp()
299 if (p_reply + ((p_ccb->num_handles - orig) * 4) + 1 > p_reply_end) { in process_service_search_rsp()
301 sdp_disconnect(p_ccb, SDP_GENERIC_ERROR); in process_service_search_rsp()
305 for (xx = orig; xx < p_ccb->num_handles; xx++) in process_service_search_rsp()
306 BE_STREAM_TO_UINT32(p_ccb->handles[xx], p_reply); in process_service_search_rsp()
311 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE); in process_service_search_rsp()
316 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE); in process_service_search_rsp()
320 sdp_snd_service_search_req(p_ccb, cont_len, p_reply); in process_service_search_rsp()
323 p_ccb->disc_state = SDP_DISC_WAIT_ATTR; in process_service_search_rsp()
326 process_service_attr_rsp(p_ccb, NULL, NULL); in process_service_search_rsp()
343 static bool sdp_copy_raw_data(tCONN_CB* p_ccb, bool offset) { in sdp_copy_raw_data() argument
350 if (p_ccb->p_db->raw_data) { in sdp_copy_raw_data()
351 cpy_len = p_ccb->p_db->raw_size - p_ccb->p_db->raw_used; in sdp_copy_raw_data()
352 list_len = p_ccb->list_len; in sdp_copy_raw_data()
353 p = &p_ccb->rsp_list[0]; in sdp_copy_raw_data()
354 p_end = &p_ccb->rsp_list[0] + list_len; in sdp_copy_raw_data()
374 rem_len = SDP_MAX_LIST_BYTE_COUNT - (unsigned int)(p - &p_ccb->rsp_list[0]); in sdp_copy_raw_data()
379 memcpy(&p_ccb->p_db->raw_data[p_ccb->p_db->raw_used], p, cpy_len); in sdp_copy_raw_data()
380 p_ccb->p_db->raw_used += cpy_len; in sdp_copy_raw_data()
396 static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, in process_service_attr_rsp() argument
406 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE); in process_service_attr_rsp()
417 if ((p_ccb->list_len + list_byte_count) > SDP_MAX_LIST_BYTE_COUNT) { in process_service_attr_rsp()
418 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE); in process_service_attr_rsp()
422 if (p_ccb->rsp_list == NULL) in process_service_attr_rsp()
423 p_ccb->rsp_list = (uint8_t*)osi_malloc(SDP_MAX_LIST_BYTE_COUNT); in process_service_attr_rsp()
424 memcpy(&p_ccb->rsp_list[p_ccb->list_len], p_reply, list_byte_count); in process_service_attr_rsp()
425 p_ccb->list_len += list_byte_count; in process_service_attr_rsp()
429 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE); in process_service_attr_rsp()
436 if (!sdp_copy_raw_data(p_ccb, false)) { in process_service_attr_rsp()
438 sdp_disconnect(p_ccb, SDP_ILLEGAL_PARAMETER); in process_service_attr_rsp()
445 if (!save_attr_seq(p_ccb, &p_ccb->rsp_list[0], in process_service_attr_rsp()
446 &p_ccb->rsp_list[p_ccb->list_len])) { in process_service_attr_rsp()
447 sdp_disconnect(p_ccb, SDP_DB_FULL); in process_service_attr_rsp()
450 p_ccb->list_len = 0; in process_service_attr_rsp()
451 p_ccb->cur_handle++; in process_service_attr_rsp()
456 if (p_ccb->cur_handle < p_ccb->num_handles) { in process_service_attr_rsp()
465 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id); in process_service_attr_rsp()
466 p_ccb->transaction_id++; in process_service_attr_rsp()
472 UINT32_TO_BE_STREAM(p, p_ccb->handles[p_ccb->cur_handle]); in process_service_attr_rsp()
478 if (p_ccb->p_db->num_attr_filters) in process_service_attr_rsp()
479 p = sdpu_build_attrib_seq(p, p_ccb->p_db->attr_filters, in process_service_attr_rsp()
480 p_ccb->p_db->num_attr_filters); in process_service_attr_rsp()
502 L2CA_DataWrite(p_ccb->connection_id, p_msg); in process_service_attr_rsp()
505 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS, in process_service_attr_rsp()
506 sdp_conn_timer_timeout, p_ccb); in process_service_attr_rsp()
508 sdpu_log_attribute_metrics(p_ccb->device_address, p_ccb->p_db); in process_service_attr_rsp()
509 sdp_disconnect(p_ccb, SDP_SUCCESS); in process_service_attr_rsp()
524 static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply, in process_service_search_attr_rsp() argument
537 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE); in process_service_search_attr_rsp()
548 if ((p_ccb->list_len + lists_byte_count) > SDP_MAX_LIST_BYTE_COUNT) { in process_service_search_attr_rsp()
549 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE); in process_service_search_attr_rsp()
555 sdp_disconnect(p_ccb, SDP_INVALID_PDU_SIZE); in process_service_search_attr_rsp()
559 if (p_ccb->rsp_list == NULL) in process_service_search_attr_rsp()
560 p_ccb->rsp_list = (uint8_t*)osi_malloc(SDP_MAX_LIST_BYTE_COUNT); in process_service_search_attr_rsp()
561 memcpy(&p_ccb->rsp_list[p_ccb->list_len], p_reply, lists_byte_count); in process_service_search_attr_rsp()
562 p_ccb->list_len += lists_byte_count; in process_service_search_attr_rsp()
566 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE); in process_service_search_attr_rsp()
584 UINT16_TO_BE_STREAM(p, p_ccb->transaction_id); in process_service_search_attr_rsp()
585 p_ccb->transaction_id++; in process_service_search_attr_rsp()
594 &p_ccb->p_db->uuid_filters[p_ccb->cur_uuid_idx]); in process_service_search_attr_rsp()
596 p = sdpu_build_uuid_seq(p, p_ccb->p_db->num_uuid_filters, in process_service_search_attr_rsp()
597 p_ccb->p_db->uuid_filters); in process_service_search_attr_rsp()
604 if (p_ccb->p_db->num_attr_filters) in process_service_search_attr_rsp()
605 p = sdpu_build_attrib_seq(p, p_ccb->p_db->attr_filters, in process_service_search_attr_rsp()
606 p_ccb->p_db->num_attr_filters); in process_service_search_attr_rsp()
628 L2CA_DataWrite(p_ccb->connection_id, p_msg); in process_service_search_attr_rsp()
631 alarm_set_on_mloop(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS, in process_service_search_attr_rsp()
632 sdp_conn_timer_timeout, p_ccb); in process_service_search_attr_rsp()
643 if (!sdp_copy_raw_data(p_ccb, true)) { in process_service_search_attr_rsp()
645 sdp_disconnect(p_ccb, SDP_ILLEGAL_PARAMETER); in process_service_search_attr_rsp()
650 p = &p_ccb->rsp_list[0]; in process_service_search_attr_rsp()
659 p = sdpu_get_len_from_type(p, p + p_ccb->list_len, type, &seq_len); in process_service_search_attr_rsp()
660 if (p == NULL || (p + seq_len) > (p + p_ccb->list_len)) { in process_service_search_attr_rsp()
662 sdp_disconnect(p_ccb, SDP_ILLEGAL_PARAMETER); in process_service_search_attr_rsp()
665 p_end = &p_ccb->rsp_list[p_ccb->list_len]; in process_service_search_attr_rsp()
668 sdp_disconnect(p_ccb, SDP_INVALID_CONT_STATE); in process_service_search_attr_rsp()
673 p = save_attr_seq(p_ccb, p, &p_ccb->rsp_list[p_ccb->list_len]); in process_service_search_attr_rsp()
675 sdp_disconnect(p_ccb, SDP_DB_FULL); in process_service_search_attr_rsp()
681 sdpu_log_attribute_metrics(p_ccb->device_address, p_ccb->p_db); in process_service_search_attr_rsp()
682 sdp_disconnect(p_ccb, SDP_SUCCESS); in process_service_search_attr_rsp()
695 static uint8_t* save_attr_seq(tCONN_CB* p_ccb, uint8_t* p, uint8_t* p_msg_end) { in save_attr_seq() argument
714 p_rec = add_record(p_ccb->p_db, p_ccb->device_address); in save_attr_seq()
738 p = add_attr(p, p_seq_end, p_ccb->p_db, p_rec, attr_id, NULL, 0); in save_attr_seq()