Lines Matching refs:req
107 struct bt_att_req *req; member
528 static int chan_req_send(struct bt_att_chan *chan, struct bt_att_req *req) in chan_req_send() argument
533 if (bt_att_mtu(chan) < net_buf_frags_len(req->buf)) { in chan_req_send()
537 LOG_DBG("chan %p req %p len %zu", chan, req, net_buf_frags_len(req->buf)); in chan_req_send()
539 chan->req = req; in chan_req_send()
542 buf = req->buf; in chan_req_send()
543 req->buf = NULL; in chan_req_send()
552 req->buf = buf; in chan_req_send()
553 chan->req = NULL; in chan_req_send()
555 bt_gatt_req_set_mtu(req, bt_att_mtu(chan)); in chan_req_send()
582 if (!chan->req && !sys_slist_is_empty(&att->reqs)) { in bt_att_sent()
608 LOG_DBG("chan %p chan->req %p", chan, chan->req); in chan_rebegin_att_timeout()
618 if (chan->req) { in chan_rebegin_att_timeout()
785 static void send_err_rsp(struct bt_att_chan *chan, uint8_t req, uint16_t handle, in send_err_rsp() argument
792 if (!req) { in send_err_rsp()
802 rsp->request = req; in send_err_rsp()
811 struct bt_att_exchange_mtu_req *req; in att_mtu_req() local
823 req = (void *)buf->data; in att_mtu_req()
825 mtu_client = sys_le16_to_cpu(req->mtu); in att_mtu_req()
872 struct bt_att_req *req) in bt_att_chan_req_send() argument
875 __ASSERT_NO_MSG(req); in bt_att_chan_req_send()
876 __ASSERT_NO_MSG(req->func); in bt_att_chan_req_send()
877 __ASSERT_NO_MSG(!chan->req); in bt_att_chan_req_send()
879 LOG_DBG("req %p", req); in bt_att_chan_req_send()
881 return chan_req_send(chan, req); in bt_att_chan_req_send()
886 struct bt_att_req *req = NULL; in att_req_send_process() local
891 if (chan->req) { in att_req_send_process()
895 if (!req && prev && (bt_att_is_enhanced(chan) == bt_att_is_enhanced(prev))) { in att_req_send_process()
906 req = get_first_req_matching_chan(&att->reqs, chan); in att_req_send_process()
907 if (!req) { in att_req_send_process()
911 if (bt_att_chan_req_send(chan, req) >= 0) { in att_req_send_process()
916 sys_slist_prepend(&att->reqs, &req->node); in att_req_send_process()
931 if (!chan->req) { in att_handle_rsp()
937 if (chan->req == &cancel) { in att_handle_rsp()
938 chan->req = NULL; in att_handle_rsp()
943 func = chan->req->func; in att_handle_rsp()
944 chan->req->func = NULL; in att_handle_rsp()
945 params = chan->req->user_data; in att_handle_rsp()
948 bt_att_req_free(chan->req); in att_handle_rsp()
949 chan->req = NULL; in att_handle_rsp()
1109 struct bt_att_find_info_req *req; in att_find_info_req() local
1112 req = (void *)buf->data; in att_find_info_req()
1114 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_info_req()
1115 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_info_req()
1271 struct bt_att_find_type_req *req; in att_find_type_req() local
1275 req = net_buf_pull_mem(buf, sizeof(*req)); in att_find_type_req()
1277 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_type_req()
1278 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_type_req()
1279 type = sys_le16_to_cpu(req->type); in att_find_type_req()
1520 struct bt_att_read_type_req *req; in att_read_type_req() local
1527 uint8_t uuid_len = buf->len - sizeof(*req); in att_read_type_req()
1534 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_type_req()
1536 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_type_req()
1537 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_type_req()
1538 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_type_req()
1670 struct bt_att_read_req *req; in att_read_req() local
1673 req = (void *)buf->data; in att_read_req()
1675 handle = sys_le16_to_cpu(req->handle); in att_read_req()
1685 struct bt_att_read_blob_req *req; in att_read_blob_req() local
1688 req = (void *)buf->data; in att_read_blob_req()
1690 handle = sys_le16_to_cpu(req->handle); in att_read_blob_req()
1691 offset = sys_le16_to_cpu(req->offset); in att_read_blob_req()
1969 struct bt_att_read_group_req *req; in att_read_group_req() local
1976 uint8_t uuid_len = buf->len - sizeof(*req); in att_read_group_req()
1983 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_group_req()
1985 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_group_req()
1986 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_group_req()
1988 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_group_req()
2021 uint8_t req; member
2065 if (!data->req) { in write_cb()
2067 } else if (data->req == BT_ATT_OP_EXEC_WRITE_REQ) { in write_cb()
2084 static uint8_t att_write_rsp(struct bt_att_chan *chan, uint8_t req, uint8_t rsp, in att_write_rsp() argument
2090 if (!bt_gatt_change_aware(chan->att->conn, req ? true : false)) { in att_write_rsp()
2113 data.req = req; in att_write_rsp()
2126 send_err_rsp(chan, req, handle, data.err); in att_write_rsp()
2128 return req == BT_ATT_OP_EXEC_WRITE_REQ ? data.err : 0; in att_write_rsp()
2277 struct bt_att_prepare_write_req *req; in att_prepare_write_req()
2280 req = net_buf_pull_mem(buf, sizeof(*req)); in att_prepare_write_req()
2282 handle = sys_le16_to_cpu(req->handle); in att_prepare_write_req()
2283 offset = sys_le16_to_cpu(req->offset); in att_prepare_write_req()
2419 struct bt_att_exec_write_req *req; in att_exec_write_req()
2421 req = (void *)buf->data; in att_exec_write_req()
2423 LOG_DBG("flags 0x%02x", req->flags); in att_exec_write_req()
2425 return att_exec_write_rsp(chan, req->flags); in att_exec_write_req()
2444 struct bt_att_signed_write_cmd *req; in att_signed_write_cmd() local
2456 req = (void *)buf->data; in att_signed_write_cmd()
2458 handle = sys_le16_to_cpu(req->handle); in att_signed_write_cmd()
2472 net_buf_pull(buf, sizeof(*req)); in att_signed_write_cmd()
2564 if (!chan->req || chan->req == &cancel || !rsp->error) { in att_error_rsp()
2583 chan->req->retrying = true; in att_error_rsp()
3096 struct bt_att_req *req; in att_reset() local
3100 req = CONTAINER_OF(node, struct bt_att_req, node); in att_reset()
3101 if (req->func) { in att_reset()
3102 req->func(att->conn, -ECONNRESET, NULL, 0, in att_reset()
3103 req->user_data); in att_reset()
3106 bt_att_req_free(req); in att_reset()
3129 if (chan->req) { in att_chan_detach()
3239 struct bt_att_req *req = att_chan->req; in att_req_retry() local
3243 if (!req->encode) { in att_req_retry()
3249 buf = bt_att_chan_create_pdu(att_chan, req->att_op, req->len); in att_req_retry()
3254 if (req->encode(buf, req->len, req->user_data)) { in att_req_retry()
3288 if (att_chan->req && att_chan->req->retrying) { in bt_att_encrypt_change()
3302 if (!(att_chan->req && att_chan->req->retrying)) { in bt_att_encrypt_change()
3333 if (chan->req) { in bt_att_status()
3917 struct bt_att_req *req = NULL; in bt_att_req_alloc() local
3928 if (k_mem_slab_alloc(&req_slab, (void **)&req, timeout)) { in bt_att_req_alloc()
3933 LOG_DBG("req %p", req); in bt_att_req_alloc()
3935 memset(req, 0, sizeof(*req)); in bt_att_req_alloc()
3937 return req; in bt_att_req_alloc()
3940 void bt_att_req_free(struct bt_att_req *req) in bt_att_req_free() argument
3942 LOG_DBG("req %p", req); in bt_att_req_free()
3944 if (req->buf) { in bt_att_req_free()
3945 net_buf_unref(req->buf); in bt_att_req_free()
3946 req->buf = NULL; in bt_att_req_free()
3949 k_mem_slab_free(&req_slab, (void *)req); in bt_att_req_free()
3971 int bt_att_req_send(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_send() argument
3975 LOG_DBG("conn %p req %p", conn, req); in bt_att_req_send()
3978 __ASSERT_NO_MSG(req); in bt_att_req_send()
3988 sys_slist_append(&att->reqs, &req->node); in bt_att_req_send()
3997 struct bt_att_req *req) in bt_att_chan_req_cancel() argument
3999 if (chan->req != req) { in bt_att_chan_req_cancel()
4003 chan->req = &cancel; in bt_att_chan_req_cancel()
4005 bt_att_req_free(req); in bt_att_chan_req_cancel()
4010 void bt_att_req_cancel(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_cancel() argument
4015 LOG_DBG("req %p", req); in bt_att_req_cancel()
4017 if (!conn || !req) { in bt_att_req_cancel()
4028 if (bt_att_chan_req_cancel(chan, req)) { in bt_att_req_cancel()
4034 sys_slist_find_and_remove(&att->reqs, &req->node); in bt_att_req_cancel()
4036 bt_att_req_free(req); in bt_att_req_cancel()
4043 struct bt_att_req *req; in bt_att_find_req_by_user_data() local
4051 if (chan->req->user_data == user_data) { in bt_att_find_req_by_user_data()
4052 return chan->req; in bt_att_find_req_by_user_data()
4056 SYS_SLIST_FOR_EACH_CONTAINER(&att->reqs, req, node) { in bt_att_find_req_by_user_data()
4057 if (req->user_data == user_data) { in bt_att_find_req_by_user_data()
4058 return req; in bt_att_find_req_by_user_data()