Bluetooth: SDP: Introduce ContinuationState of PDU
Adds initial handling of PDU Continuation State. It has crutial role to interact with SDP server when receiving partial SDP PDU responses. < ACL Data TX: Handle 77 flags 0x00 dlen 24 Channel: 64 len 20 [PSM 1 mode 0] {chan 0} SDP: Service Search Attribute Request (0x06) tid 3 len 15 Search pattern: [len 5] Sequence (6) with 3 bytes [8 extra bits] len 5 UUID (3) with 2 bytes [0 extra bits] len 3 OBEX Object Push (0x1105) Max record count: 65535 Attribute list: [len 7] Sequence (6) with 5 bytes [8 extra bits] len 7 Unsigned Integer (1) with 4 bytes [0 extra bits] len 5 0x0000ffff Continuation state: 0 > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 77 Count: 1 > ACL Data RX: Handle 77 flags 0x02 dlen 68 Channel: 64 len 64 [PSM 1 mode 0] {chan 0} SDP: Service Search Attribute Response (0x07) tid 3 len 59 Attribute bytes: 48 Continuation state: 8 8d 55 59 58 30 00 00 00 .UYX0... Jira: ZEP-1112 Change-Id: I53ea9ae64c3f2685c9a12be3683dfc3a95aa8bf9 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
This commit is contained in:
parent
5f3ce62eed
commit
ce61122cdf
2 changed files with 24 additions and 2 deletions
|
@ -69,6 +69,8 @@ struct bt_sdp_client {
|
|||
uint16_t tid;
|
||||
/* UUID params holder being now resolved */
|
||||
const struct bt_sdp_discover_params *param;
|
||||
/* PDU continuation state object */
|
||||
struct bt_sdp_pdu_cstate cstate;
|
||||
};
|
||||
|
||||
static struct bt_sdp_client bt_sdp_client_pool[CONFIG_BLUETOOTH_MAX_CONN];
|
||||
|
@ -401,8 +403,19 @@ static int sdp_client_ssa_search(struct bt_sdp_client *session)
|
|||
net_buf_add_be16(buf, 0x0000);
|
||||
net_buf_add_be16(buf, 0xffff);
|
||||
|
||||
/* Initial continuation state octet */
|
||||
net_buf_add_u8(buf, 0x00);
|
||||
/*
|
||||
* Update and validate PDU ContinuationState. Initial SSA Request has
|
||||
* zero length continuation state since no interaction has place with
|
||||
* server so far, otherwise use the original state taken from remote's
|
||||
* last response PDU that is cached by SDP client context.
|
||||
*/
|
||||
if (session->cstate.length == 0) {
|
||||
net_buf_add_u8(buf, 0x00);
|
||||
} else {
|
||||
net_buf_add_u8(buf, session->cstate.length);
|
||||
net_buf_add_mem(buf, session->cstate.data,
|
||||
session->cstate.length);
|
||||
}
|
||||
|
||||
/* set overall PDU length */
|
||||
hdr->param_len = sys_cpu_to_be16(buf->len - sizeof(*hdr));
|
||||
|
|
|
@ -56,4 +56,13 @@ struct bt_sdp_hdr {
|
|||
/* Allowed attributes length in SSA Request PDU to be taken from server */
|
||||
#define BT_SDP_MAX_ATTR_LEN 0xffff
|
||||
|
||||
/* Max allowed length of PDU Continuation State */
|
||||
#define BT_SDP_MAX_PDU_CSTATE_LEN 16
|
||||
|
||||
/* Type mapping SDP PDU Continuation State */
|
||||
struct bt_sdp_pdu_cstate {
|
||||
uint8_t length;
|
||||
uint8_t data[BT_SDP_MAX_PDU_CSTATE_LEN];
|
||||
} __packed;
|
||||
|
||||
void bt_sdp_init(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue