Lines Matching refs:req

106 	struct bt_att_req	*req;  member
138 static void att_req_destroy(struct bt_att_req *req) in att_req_destroy() argument
140 BT_DBG("req %p", req); in att_req_destroy()
142 if (req->buf) { in att_req_destroy()
143 net_buf_unref(req->buf); in att_req_destroy()
146 if (req->destroy) { in att_req_destroy()
147 req->destroy(req); in att_req_destroy()
150 bt_att_req_free(req); in att_req_destroy()
224 if (chan->req && chan->req->buf == buf) { in bt_att_sent()
226 net_buf_simple_save(&chan->req->buf->b, in bt_att_sent()
227 &chan->req->state); in bt_att_sent()
262 BT_DBG("chan %p chan->req %p", chan, chan->req); in chan_req_sent()
265 if (chan->req) { in chan_req_sent()
344 static void send_err_rsp(struct bt_att_chan *chan, u8_t req, u16_t handle, in send_err_rsp() argument
351 if (!req) { in send_err_rsp()
361 rsp->request = req; in send_err_rsp()
377 struct bt_att_exchange_mtu_req *req; in att_mtu_req() local
389 req = (void *)buf->data; in att_mtu_req()
391 mtu_client = sys_le16_to_cpu(req->mtu); in att_mtu_req()
430 struct bt_att_req *req) in bt_att_chan_req_send() argument
435 __ASSERT_NO_MSG(req); in bt_att_chan_req_send()
436 __ASSERT_NO_MSG(req->func); in bt_att_chan_req_send()
437 __ASSERT_NO_MSG(!chan->req); in bt_att_chan_req_send()
439 BT_DBG("req %p", req); in bt_att_chan_req_send()
441 if (chan->chan.tx.mtu < net_buf_frags_len(req->buf)) { in bt_att_chan_req_send()
449 BT_DBG("chan %p req %p len %zu", chan, req, in bt_att_chan_req_send()
450 net_buf_frags_len(req->buf)); in bt_att_chan_req_send()
452 chan->req = req; in bt_att_chan_req_send()
455 net_buf_simple_save(&req->buf->b, &req->state); in bt_att_chan_req_send()
458 err = chan_send(chan, net_buf_ref(req->buf), NULL); in bt_att_chan_req_send()
460 net_buf_unref(req->buf); in bt_att_chan_req_send()
461 req->buf = NULL; in bt_att_chan_req_send()
463 chan->req = NULL; in bt_att_chan_req_send()
484 if (!chan->req) { in att_process()
507 if (!chan->req) { in att_handle_rsp()
513 if (chan->req == &cancel) { in att_handle_rsp()
514 chan->req = NULL; in att_handle_rsp()
519 if (chan->req->buf) { in att_handle_rsp()
520 net_buf_unref(chan->req->buf); in att_handle_rsp()
521 chan->req->buf = NULL; in att_handle_rsp()
525 func = chan->req->func; in att_handle_rsp()
526 chan->req->func = NULL; in att_handle_rsp()
527 params = chan->req->user_data; in att_handle_rsp()
530 att_req_destroy(chan->req); in att_handle_rsp()
531 chan->req = NULL; in att_handle_rsp()
688 struct bt_att_find_info_req *req; in att_find_info_req() local
691 req = (void *)buf->data; in att_find_info_req()
693 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_info_req()
694 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_info_req()
851 struct bt_att_find_type_req *req; in att_find_type_req() local
855 req = net_buf_pull_mem(buf, sizeof(*req)); in att_find_type_req()
857 start_handle = sys_le16_to_cpu(req->start_handle); in att_find_type_req()
858 end_handle = sys_le16_to_cpu(req->end_handle); in att_find_type_req()
859 type = sys_le16_to_cpu(req->type); in att_find_type_req()
1082 struct bt_att_read_type_req *req; in att_read_type_req() local
1089 u8_t uuid_len = buf->len - sizeof(*req); in att_read_type_req()
1096 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_type_req()
1098 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_type_req()
1099 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_type_req()
1100 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_type_req()
1201 struct bt_att_read_req *req; in att_read_req() local
1204 req = (void *)buf->data; in att_read_req()
1206 handle = sys_le16_to_cpu(req->handle); in att_read_req()
1216 struct bt_att_read_blob_req *req; in att_read_blob_req() local
1219 req = (void *)buf->data; in att_read_blob_req()
1221 handle = sys_le16_to_cpu(req->handle); in att_read_blob_req()
1222 offset = sys_le16_to_cpu(req->offset); in att_read_blob_req()
1482 struct bt_att_read_group_req *req; in att_read_group_req() local
1489 u8_t uuid_len = buf->len - sizeof(*req); in att_read_group_req()
1496 req = net_buf_pull_mem(buf, sizeof(*req)); in att_read_group_req()
1498 start_handle = sys_le16_to_cpu(req->start_handle); in att_read_group_req()
1499 end_handle = sys_le16_to_cpu(req->end_handle); in att_read_group_req()
1501 if (!bt_uuid_create(&u.uuid, req->uuid, uuid_len)) { in att_read_group_req()
1534 u8_t req; member
1557 if (!data->req) { in write_cb()
1574 static u8_t att_write_rsp(struct bt_att_chan *chan, u8_t req, u8_t rsp, in att_write_rsp() argument
1580 if (!bt_gatt_change_aware(chan->att->conn, req ? true : false)) { in att_write_rsp()
1599 data.req = req; in att_write_rsp()
1612 send_err_rsp(chan, req, handle, data.err); in att_write_rsp()
1614 return req == BT_ATT_OP_EXEC_WRITE_REQ ? data.err : 0; in att_write_rsp()
1753 struct bt_att_prepare_write_req *req; in att_prepare_write_req()
1756 req = net_buf_pull_mem(buf, sizeof(*req)); in att_prepare_write_req()
1758 handle = sys_le16_to_cpu(req->handle); in att_prepare_write_req()
1759 offset = sys_le16_to_cpu(req->offset); in att_prepare_write_req()
1817 struct bt_att_exec_write_req *req; in att_exec_write_req()
1819 req = (void *)buf->data; in att_exec_write_req()
1821 BT_DBG("flags 0x%02x", req->flags); in att_exec_write_req()
1823 return att_exec_write_rsp(chan, req->flags); in att_exec_write_req()
1842 struct bt_att_signed_write_cmd *req; in att_signed_write_cmd() local
1846 req = (void *)buf->data; in att_signed_write_cmd()
1848 handle = sys_le16_to_cpu(req->handle); in att_signed_write_cmd()
1862 net_buf_pull(buf, sizeof(*req)); in att_signed_write_cmd()
1943 if (!chan->req || chan->req == &cancel) { in att_error_rsp()
1948 if (chan->req->buf) { in att_error_rsp()
1950 net_buf_simple_restore(&chan->req->buf->b, &chan->req->state); in att_error_rsp()
1955 if (chan->req->retrying) { in att_error_rsp()
1961 chan->req->retrying = true; in att_error_rsp()
2415 struct bt_att_req *req, *tmp; in att_reset() local
2432 SYS_SLIST_FOR_EACH_CONTAINER_SAFE(&att->reqs, req, tmp, node) { in att_reset()
2433 if (req->func) { in att_reset()
2434 req->func(NULL, BT_ATT_ERR_UNLIKELY, NULL, 0, in att_reset()
2435 req->user_data); in att_reset()
2438 att_req_destroy(req); in att_reset()
2459 if (chan->req) { in att_chan_detach()
2589 if (!att_chan->req || !att_chan->req->retrying) { in bt_att_encrypt_change()
2596 (void)bt_att_chan_send(att_chan, att_chan->req->buf, in bt_att_encrypt_change()
2597 chan_cb(att_chan->req->buf)); in bt_att_encrypt_change()
2599 att_chan->req->buf = NULL; in bt_att_encrypt_change()
2615 if (chan->req) { in bt_att_status()
2846 struct bt_att_req *req = NULL; in bt_att_req_alloc() local
2848 k_mem_slab_alloc_req(req); in bt_att_req_alloc()
2850 BT_DBG("req %p", req); in bt_att_req_alloc()
2852 return req; in bt_att_req_alloc()
2855 void bt_att_req_free(struct bt_att_req *req) in bt_att_req_free() argument
2857 BT_DBG("req %p", req); in bt_att_req_free()
2860 req->used = 0; in bt_att_req_free()
2861 req = NULL; in bt_att_req_free()
2906 int bt_att_req_send(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_send() argument
2911 BT_DBG("conn %p req %p", conn, req); in bt_att_req_send()
2914 __ASSERT_NO_MSG(req); in bt_att_req_send()
2918 net_buf_unref(req->buf); in bt_att_req_send()
2919 req->buf = NULL; in bt_att_req_send()
2925 if (!chan->req) { in bt_att_req_send()
2928 ret = bt_att_chan_req_send(chan, req); in bt_att_req_send()
2936 sys_slist_append(&att->reqs, &req->node); in bt_att_req_send()
2938 BT_DBG("req %p queued", req); in bt_att_req_send()
2944 struct bt_att_req *req) in bt_att_chan_req_cancel() argument
2946 if (chan->req != req) { in bt_att_chan_req_cancel()
2950 chan->req = &cancel; in bt_att_chan_req_cancel()
2952 att_req_destroy(req); in bt_att_chan_req_cancel()
2957 void bt_att_req_cancel(struct bt_conn *conn, struct bt_att_req *req) in bt_att_req_cancel() argument
2962 BT_DBG("req %p", req); in bt_att_req_cancel()
2964 if (!conn || !req) { in bt_att_req_cancel()
2975 if (bt_att_chan_req_cancel(chan, req)) { in bt_att_req_cancel()
2981 sys_slist_find_and_remove(&att->reqs, &req->node); in bt_att_req_cancel()
2983 att_req_destroy(req); in bt_att_req_cancel()