zephyr/subsys/bluetooth/host/sdp_internal.h

75 lines
1.8 KiB
C
Raw Normal View History

/* sdp_internal.h - Service Discovery Protocol handling */
/*
* Copyright (c) 2015-2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* The PDU identifiers of SDP packets between client and server
*/
#define BT_SDP_ERROR_RSP 0x01
#define BT_SDP_SVC_SEARCH_REQ 0x02
#define BT_SDP_SVC_SEARCH_RSP 0x03
#define BT_SDP_SVC_ATTR_REQ 0x04
#define BT_SDP_SVC_ATTR_RSP 0x05
#define BT_SDP_SVC_SEARCH_ATTR_REQ 0x06
#define BT_SDP_SVC_SEARCH_ATTR_RSP 0x07
/*
* Some additions to support service registration.
* These are outside the scope of the Bluetooth specification
*/
#define BT_SDP_SVC_REGISTER_REQ 0x75
#define BT_SDP_SVC_REGISTER_RSP 0x76
#define BT_SDP_SVC_UPDATE_REQ 0x77
#define BT_SDP_SVC_UPDATE_RSP 0x78
#define BT_SDP_SVC_REMOVE_REQ 0x79
#define BT_SDP_SVC_REMOVE_RSP 0x80
/*
* SDP Error codes
*/
#define BT_SDP_INVALID_VERSION 0x0001
#define BT_SDP_INVALID_RECORD_HANDLE 0x0002
#define BT_SDP_INVALID_SYNTAX 0x0003
#define BT_SDP_INVALID_PDU_SIZE 0x0004
#define BT_SDP_INVALID_CSTATE 0x0005
#define BT_SDP_MAX_SERVICES 10
struct bt_sdp_data_elem_seq {
u8_t type; /* Type: Will be data element sequence */
u16_t size; /* We only support 2 byte sizes for now */
} __packed;
struct bt_sdp_hdr {
u8_t op_code;
u16_t tid;
u16_t param_len;
} __packed;
struct bt_sdp_svc_rsp {
u16_t total_recs;
u16_t current_recs;
} __packed;
struct bt_sdp_att_rsp {
u16_t att_list_len;
} __packed;
Bluetooth: SDP: Implement ServiceSearchAttribute request PDU Initial implementation one of basic UUID resolving request PDU based on Service Search Attribute PDU specification [Core 4.2 Vol 3 Part B 4.7.1] The request applies approach to query using single only UUID pattern and getting all attributes for given UUID. The initial PDU transaction is requested on PSM SDP L2CAP channel connected state. > ACL Data RX: Handle 77 flags 0x02 dlen 18 L2CAP: Configure Response (0x05) ident 12 len 10 Source CID: 64 Flags: 0x0000 Result: Success (0x0000) Option: Maximum Transmission Unit (0x01) [mandatory] MTU: 64 > HCI Event: Number of Completed Packets (0x13) plen 5 Num handles: 1 Handle: 77 Count: 1 < HCI Command: Host Number of Completed Packets (0x03|0x0035) plen 5 Num handles: 1 Handle: 77 Count: 1 < 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: I0ed1d989a5abe030f1c70d4d1f104d488eafb2b3 Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-12-21 04:45:48 +08:00
/* 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 {
u8_t length;
u8_t data[BT_SDP_MAX_PDU_CSTATE_LEN];
} __packed;
void bt_sdp_init(void);