Lines Matching refs:req
120 struct bt_att_req *req; member
541 static int bt_att_chan_req_send(struct bt_att_chan *chan, struct bt_att_req *req) in bt_att_chan_req_send() argument
546 if (bt_att_mtu(chan) < net_buf_frags_len(req->buf)) { in bt_att_chan_req_send()
550 LOG_DBG("chan %p req %p len %zu", chan, req, net_buf_frags_len(req->buf)); in bt_att_chan_req_send()
552 chan->req = req; in bt_att_chan_req_send()
555 buf = req->buf; in bt_att_chan_req_send()
556 req->buf = NULL; in bt_att_chan_req_send()
565 req->buf = buf; in bt_att_chan_req_send()
566 chan->req = NULL; in bt_att_chan_req_send()
568 bt_gatt_req_set_mtu(req, bt_att_mtu(chan)); in bt_att_chan_req_send()
595 if (!chan->req && !sys_slist_is_empty(&att->reqs)) { in bt_att_sent()
622 LOG_DBG("chan %p chan->req %p", chan, chan->req); in chan_rebegin_att_timeout()
632 if (chan->req) { in chan_rebegin_att_timeout()
821 static void send_err_rsp(struct bt_att_chan *chan, uint8_t req, uint16_t handle, in send_err_rsp() argument
828 if (!req) { in send_err_rsp()
838 rsp->request = req; in send_err_rsp()
847 struct bt_att_exchange_mtu_req *req; in att_mtu_req() local
859 req = (void *)buf->data; in att_mtu_req()
861 mtu_client = sys_le16_to_cpu(req->mtu); in att_mtu_req()
909 struct bt_att_req *req = NULL; in att_req_send_process() local
914 if (chan->req) { in att_req_send_process()
918 if (!req && prev && (bt_att_is_enhanced(chan) == bt_att_is_enhanced(prev))) { in att_req_send_process()
929 req = get_first_req_matching_chan(&att->reqs, chan); in att_req_send_process()
930 if (!req) { in att_req_send_process()
934 if (bt_att_chan_req_send(chan, req) == 0) { in att_req_send_process()
939 sys_slist_prepend(&att->reqs, &req->node); in att_req_send_process()
954 if (!chan->req) { in att_handle_rsp()
961 if (chan->req == &cancel) { in att_handle_rsp()
962 chan->req = NULL; in att_handle_rsp()
967 func = chan->req->func; in att_handle_rsp()
968 chan->req->func = NULL; in att_handle_rsp()
969 params = chan->req->user_data; in att_handle_rsp()
972 bt_att_req_free(chan->req); in att_handle_rsp()
973 chan->req = NULL; in att_handle_rsp()
1133 struct bt_att_find_info_req *req; in att_find_info_req() local
1136 req = (void *)buf->data; in att_find_info_req()
1138 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_info_req()
1139 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_info_req()
1295 struct bt_att_find_type_req *req; in att_find_type_req() local
1299 req = net_buf_pull_mem(buf, sizeof(*req)); in att_find_type_req()
1301 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_type_req()
1302 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_type_req()
1303 type = sys_le16_to_cpu(req->type); in att_find_type_req()
1544 struct bt_att_read_type_req *req; in att_read_type_req() local
1551 uint8_t uuid_len = buf->len - sizeof(*req); in att_read_type_req()
1558 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_type_req()
1560 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_type_req()
1561 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_type_req()
1562 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_type_req()
1694 struct bt_att_read_req *req; in att_read_req() local
1697 req = (void *)buf->data; in att_read_req()
1699 handle = sys_le16_to_cpu(req->handle); in att_read_req()
1709 struct bt_att_read_blob_req *req; in att_read_blob_req() local
1712 req = (void *)buf->data; in att_read_blob_req()
1714 handle = sys_le16_to_cpu(req->handle); in att_read_blob_req()
1715 offset = sys_le16_to_cpu(req->offset); in att_read_blob_req()
1993 struct bt_att_read_group_req *req; in att_read_group_req() local
2000 uint8_t uuid_len = buf->len - sizeof(*req); in att_read_group_req()
2007 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_group_req()
2009 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_group_req()
2010 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_group_req()
2012 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_group_req()
2045 uint8_t req; member
2089 if (!data->req) { in write_cb()
2091 } else if (data->req == BT_ATT_OP_EXEC_WRITE_REQ) { in write_cb()
2108 static uint8_t att_write_rsp(struct bt_att_chan *chan, uint8_t req, uint8_t rsp, in att_write_rsp() argument
2114 if (!bt_gatt_change_aware(chan->att->conn, req ? true : false)) { in att_write_rsp()
2137 data.req = req; in att_write_rsp()
2150 send_err_rsp(chan, req, handle, data.err); in att_write_rsp()
2152 return req == BT_ATT_OP_EXEC_WRITE_REQ ? data.err : 0; in att_write_rsp()
2301 struct bt_att_prepare_write_req *req; in att_prepare_write_req()
2304 req = net_buf_pull_mem(buf, sizeof(*req)); in att_prepare_write_req()
2306 handle = sys_le16_to_cpu(req->handle); in att_prepare_write_req()
2307 offset = sys_le16_to_cpu(req->offset); in att_prepare_write_req()
2443 struct bt_att_exec_write_req *req; in att_exec_write_req()
2445 req = (void *)buf->data; in att_exec_write_req()
2447 LOG_DBG("flags 0x%02x", req->flags); in att_exec_write_req()
2449 return att_exec_write_rsp(chan, req->flags); in att_exec_write_req()
2468 struct bt_att_signed_write_cmd *req; in att_signed_write_cmd() local
2480 req = (void *)buf->data; in att_signed_write_cmd()
2482 handle = sys_le16_to_cpu(req->handle); in att_signed_write_cmd()
2496 net_buf_pull(buf, sizeof(*req)); in att_signed_write_cmd()
2588 if (!chan->req || chan->req == &cancel || !rsp->error) { in att_error_rsp()
2607 chan->req->retrying = true; in att_error_rsp()
3120 struct bt_att_req *req; in att_reset() local
3124 req = CONTAINER_OF(node, struct bt_att_req, node); in att_reset()
3125 if (req->func) { in att_reset()
3126 req->func(att->conn, -ECONNRESET, NULL, 0, in att_reset()
3127 req->user_data); in att_reset()
3130 bt_att_req_free(req); in att_reset()
3153 if (chan->req) { in att_chan_detach()
3257 struct bt_att_req *req = att_chan->req; in att_req_retry() local
3261 if (!req->encode) { in att_req_retry()
3267 buf = bt_att_chan_create_pdu(att_chan, req->att_op, req->len); in att_req_retry()
3272 if (req->encode(buf, req->len, req->user_data)) { in att_req_retry()
3306 if (att_chan->req && att_chan->req->retrying) { in bt_att_encrypt_change()
3320 if (!(att_chan->req && att_chan->req->retrying)) { in bt_att_encrypt_change()
3351 if (chan->req) { in bt_att_status()
3935 struct bt_att_req *req = NULL; in bt_att_req_alloc() local
3959 if (k_mem_slab_alloc(&req_slab, (void **)&req, timeout)) { in bt_att_req_alloc()
3964 LOG_DBG("req %p", req); in bt_att_req_alloc()
3966 memset(req, 0, sizeof(*req)); in bt_att_req_alloc()
3968 return req; in bt_att_req_alloc()
3971 void bt_att_req_free(struct bt_att_req *req) in bt_att_req_free() argument
3973 LOG_DBG("req %p", req); in bt_att_req_free()
3975 if (req->buf) { in bt_att_req_free()
3976 net_buf_unref(req->buf); in bt_att_req_free()
3977 req->buf = NULL; in bt_att_req_free()
3980 k_mem_slab_free(&req_slab, (void *)req); in bt_att_req_free()
4002 int bt_att_req_send(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_send() argument
4006 LOG_DBG("conn %p req %p", conn, req); in bt_att_req_send()
4009 __ASSERT_NO_MSG(req); in bt_att_req_send()
4019 sys_slist_append(&att->reqs, &req->node); in bt_att_req_send()
4028 struct bt_att_req *req) in bt_att_chan_req_cancel() argument
4030 if (chan->req != req) { in bt_att_chan_req_cancel()
4034 chan->req = &cancel; in bt_att_chan_req_cancel()
4036 bt_att_req_free(req); in bt_att_chan_req_cancel()
4041 void bt_att_req_cancel(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_cancel() argument
4046 LOG_DBG("req %p", req); in bt_att_req_cancel()
4048 if (!conn || !req) { in bt_att_req_cancel()
4059 if (bt_att_chan_req_cancel(chan, req)) { in bt_att_req_cancel()
4065 sys_slist_find_and_remove(&att->reqs, &req->node); in bt_att_req_cancel()
4067 bt_att_req_free(req); in bt_att_req_cancel()
4074 struct bt_att_req *req; in bt_att_find_req_by_user_data() local
4082 if (chan->req->user_data == user_data) { in bt_att_find_req_by_user_data()
4083 return chan->req; in bt_att_find_req_by_user_data()
4087 SYS_SLIST_FOR_EACH_CONTAINER(&att->reqs, req, node) { in bt_att_find_req_by_user_data()
4088 if (req->user_data == user_data) { in bt_att_find_req_by_user_data()
4089 return req; in bt_att_find_req_by_user_data()