Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sdp.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_SDP_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_SDP_H_
12
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 * All definitions are based on Bluetooth Assigned Numbers
30 * of the Bluetooth Specification
31 */
32
37#define BT_SDP_SDP_SERVER_SVCLASS 0x1000
38#define BT_SDP_BROWSE_GRP_DESC_SVCLASS 0x1001
39#define BT_SDP_PUBLIC_BROWSE_GROUP 0x1002
40#define BT_SDP_SERIAL_PORT_SVCLASS 0x1101
41#define BT_SDP_LAN_ACCESS_SVCLASS 0x1102
42#define BT_SDP_DIALUP_NET_SVCLASS 0x1103
43#define BT_SDP_IRMC_SYNC_SVCLASS 0x1104
44#define BT_SDP_OBEX_OBJPUSH_SVCLASS 0x1105
45#define BT_SDP_OBEX_FILETRANS_SVCLASS 0x1106
46#define BT_SDP_IRMC_SYNC_CMD_SVCLASS 0x1107
47#define BT_SDP_HEADSET_SVCLASS 0x1108
48#define BT_SDP_CORDLESS_TELEPHONY_SVCLASS 0x1109
49#define BT_SDP_AUDIO_SOURCE_SVCLASS 0x110a
50#define BT_SDP_AUDIO_SINK_SVCLASS 0x110b
51#define BT_SDP_AV_REMOTE_TARGET_SVCLASS 0x110c
52#define BT_SDP_ADVANCED_AUDIO_SVCLASS 0x110d
53#define BT_SDP_AV_REMOTE_SVCLASS 0x110e
54#define BT_SDP_AV_REMOTE_CONTROLLER_SVCLASS 0x110f
55#define BT_SDP_INTERCOM_SVCLASS 0x1110
56#define BT_SDP_FAX_SVCLASS 0x1111
57#define BT_SDP_HEADSET_AGW_SVCLASS 0x1112
58#define BT_SDP_WAP_SVCLASS 0x1113
59#define BT_SDP_WAP_CLIENT_SVCLASS 0x1114
60#define BT_SDP_PANU_SVCLASS 0x1115
61#define BT_SDP_NAP_SVCLASS 0x1116
62#define BT_SDP_GN_SVCLASS 0x1117
63#define BT_SDP_DIRECT_PRINTING_SVCLASS 0x1118
64#define BT_SDP_REFERENCE_PRINTING_SVCLASS 0x1119
65#define BT_SDP_IMAGING_SVCLASS 0x111a
66#define BT_SDP_IMAGING_RESPONDER_SVCLASS 0x111b
67#define BT_SDP_IMAGING_ARCHIVE_SVCLASS 0x111c
68#define BT_SDP_IMAGING_REFOBJS_SVCLASS 0x111d
69#define BT_SDP_HANDSFREE_SVCLASS 0x111e
70#define BT_SDP_HANDSFREE_AGW_SVCLASS 0x111f
71#define BT_SDP_DIRECT_PRT_REFOBJS_SVCLASS 0x1120
72#define BT_SDP_REFLECTED_UI_SVCLASS 0x1121
73#define BT_SDP_BASIC_PRINTING_SVCLASS 0x1122
74#define BT_SDP_PRINTING_STATUS_SVCLASS 0x1123
75#define BT_SDP_HID_SVCLASS 0x1124
76#define BT_SDP_HCR_SVCLASS 0x1125
77#define BT_SDP_HCR_PRINT_SVCLASS 0x1126
78#define BT_SDP_HCR_SCAN_SVCLASS 0x1127
79#define BT_SDP_CIP_SVCLASS 0x1128
80#define BT_SDP_VIDEO_CONF_GW_SVCLASS 0x1129
81#define BT_SDP_UDI_MT_SVCLASS 0x112a
82#define BT_SDP_UDI_TA_SVCLASS 0x112b
83#define BT_SDP_AV_SVCLASS 0x112c
84#define BT_SDP_SAP_SVCLASS 0x112d
85#define BT_SDP_PBAP_PCE_SVCLASS 0x112e
86#define BT_SDP_PBAP_PSE_SVCLASS 0x112f
87#define BT_SDP_PBAP_SVCLASS 0x1130
88#define BT_SDP_MAP_MSE_SVCLASS 0x1132
89#define BT_SDP_MAP_MCE_SVCLASS 0x1133
90#define BT_SDP_MAP_SVCLASS 0x1134
91#define BT_SDP_GNSS_SVCLASS 0x1135
92#define BT_SDP_GNSS_SERVER_SVCLASS 0x1136
93#define BT_SDP_MPS_SC_SVCLASS 0x113a
94#define BT_SDP_MPS_SVCLASS 0x113b
95#define BT_SDP_PNP_INFO_SVCLASS 0x1200
96#define BT_SDP_GENERIC_NETWORKING_SVCLASS 0x1201
97#define BT_SDP_GENERIC_FILETRANS_SVCLASS 0x1202
98#define BT_SDP_GENERIC_AUDIO_SVCLASS 0x1203
99#define BT_SDP_GENERIC_TELEPHONY_SVCLASS 0x1204
100#define BT_SDP_UPNP_SVCLASS 0x1205
101#define BT_SDP_UPNP_IP_SVCLASS 0x1206
102#define BT_SDP_UPNP_PAN_SVCLASS 0x1300
103#define BT_SDP_UPNP_LAP_SVCLASS 0x1301
104#define BT_SDP_UPNP_L2CAP_SVCLASS 0x1302
105#define BT_SDP_VIDEO_SOURCE_SVCLASS 0x1303
106#define BT_SDP_VIDEO_SINK_SVCLASS 0x1304
107#define BT_SDP_VIDEO_DISTRIBUTION_SVCLASS 0x1305
108#define BT_SDP_HDP_SVCLASS 0x1400
109#define BT_SDP_HDP_SOURCE_SVCLASS 0x1401
110#define BT_SDP_HDP_SINK_SVCLASS 0x1402
111#define BT_SDP_GENERIC_ACCESS_SVCLASS 0x1800
112#define BT_SDP_GENERIC_ATTRIB_SVCLASS 0x1801
113#define BT_SDP_APPLE_AGENT_SVCLASS 0x2112
118#define BT_SDP_SERVER_RECORD_HANDLE 0x0000
119
128#define BT_SDP_ATTR_RECORD_HANDLE 0x0000
129#define BT_SDP_ATTR_SVCLASS_ID_LIST 0x0001
130#define BT_SDP_ATTR_RECORD_STATE 0x0002
131#define BT_SDP_ATTR_SERVICE_ID 0x0003
132#define BT_SDP_ATTR_PROTO_DESC_LIST 0x0004
133#define BT_SDP_ATTR_BROWSE_GRP_LIST 0x0005
134#define BT_SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006
135#define BT_SDP_ATTR_SVCINFO_TTL 0x0007
136#define BT_SDP_ATTR_SERVICE_AVAILABILITY 0x0008
137#define BT_SDP_ATTR_PROFILE_DESC_LIST 0x0009
138#define BT_SDP_ATTR_DOC_URL 0x000a
139#define BT_SDP_ATTR_CLNT_EXEC_URL 0x000b
140#define BT_SDP_ATTR_ICON_URL 0x000c
141#define BT_SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d
143#define BT_SDP_ATTR_GROUP_ID 0x0200
144#define BT_SDP_ATTR_IP_SUBNET 0x0200
145#define BT_SDP_ATTR_VERSION_NUM_LIST 0x0200
146#define BT_SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200
147#define BT_SDP_ATTR_GOEP_L2CAP_PSM 0x0200
148#define BT_SDP_ATTR_SVCDB_STATE 0x0201
150#define BT_SDP_ATTR_MPSD_SCENARIOS 0x0200
151#define BT_SDP_ATTR_MPMD_SCENARIOS 0x0201
152#define BT_SDP_ATTR_MPS_DEPENDENCIES 0x0202
154#define BT_SDP_ATTR_SERVICE_VERSION 0x0300
155#define BT_SDP_ATTR_EXTERNAL_NETWORK 0x0301
156#define BT_SDP_ATTR_SUPPORTED_DATA_STORES_LIST 0x0301
157#define BT_SDP_ATTR_DATA_EXCHANGE_SPEC 0x0301
158#define BT_SDP_ATTR_NETWORK 0x0301
159#define BT_SDP_ATTR_FAX_CLASS1_SUPPORT 0x0302
160#define BT_SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL 0x0302
161#define BT_SDP_ATTR_MCAP_SUPPORTED_PROCEDURES 0x0302
162#define BT_SDP_ATTR_FAX_CLASS20_SUPPORT 0x0303
163#define BT_SDP_ATTR_SUPPORTED_FORMATS_LIST 0x0303
164#define BT_SDP_ATTR_FAX_CLASS2_SUPPORT 0x0304
165#define BT_SDP_ATTR_AUDIO_FEEDBACK_SUPPORT 0x0305
166#define BT_SDP_ATTR_NETWORK_ADDRESS 0x0306
167#define BT_SDP_ATTR_WAP_GATEWAY 0x0307
168#define BT_SDP_ATTR_HOMEPAGE_URL 0x0308
169#define BT_SDP_ATTR_WAP_STACK_TYPE 0x0309
170#define BT_SDP_ATTR_SECURITY_DESC 0x030a
171#define BT_SDP_ATTR_NET_ACCESS_TYPE 0x030b
172#define BT_SDP_ATTR_MAX_NET_ACCESSRATE 0x030c
173#define BT_SDP_ATTR_IP4_SUBNET 0x030d
174#define BT_SDP_ATTR_IP6_SUBNET 0x030e
175#define BT_SDP_ATTR_SUPPORTED_CAPABILITIES 0x0310
176#define BT_SDP_ATTR_SUPPORTED_FEATURES 0x0311
177#define BT_SDP_ATTR_SUPPORTED_FUNCTIONS 0x0312
178#define BT_SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY 0x0313
179#define BT_SDP_ATTR_SUPPORTED_REPOSITORIES 0x0314
180#define BT_SDP_ATTR_MAS_INSTANCE_ID 0x0315
181#define BT_SDP_ATTR_SUPPORTED_MESSAGE_TYPES 0x0316
182#define BT_SDP_ATTR_PBAP_SUPPORTED_FEATURES 0x0317
183#define BT_SDP_ATTR_MAP_SUPPORTED_FEATURES 0x0317
185#define BT_SDP_ATTR_SPECIFICATION_ID 0x0200
186#define BT_SDP_ATTR_VENDOR_ID 0x0201
187#define BT_SDP_ATTR_PRODUCT_ID 0x0202
188#define BT_SDP_ATTR_VERSION 0x0203
189#define BT_SDP_ATTR_PRIMARY_RECORD 0x0204
190#define BT_SDP_ATTR_VENDOR_ID_SOURCE 0x0205
192#define BT_SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200
193#define BT_SDP_ATTR_HID_PARSER_VERSION 0x0201
194#define BT_SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202
195#define BT_SDP_ATTR_HID_COUNTRY_CODE 0x0203
196#define BT_SDP_ATTR_HID_VIRTUAL_CABLE 0x0204
197#define BT_SDP_ATTR_HID_RECONNECT_INITIATE 0x0205
198#define BT_SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206
199#define BT_SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207
200#define BT_SDP_ATTR_HID_SDP_DISABLE 0x0208
201#define BT_SDP_ATTR_HID_BATTERY_POWER 0x0209
202#define BT_SDP_ATTR_HID_REMOTE_WAKEUP 0x020a
203#define BT_SDP_ATTR_HID_PROFILE_VERSION 0x020b
204#define BT_SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c
205#define BT_SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d
206#define BT_SDP_ATTR_HID_BOOT_DEVICE 0x020e
211/*
212 * These identifiers are based on the SDP spec stating that
213 * "base attribute id of the primary (universal) language must be 0x0100"
214 *
215 * Other languages should have their own offset; e.g.:
216 * #define XXXLangBase yyyy
217 * #define AttrServiceName_XXX 0x0000+XXXLangBase
218 */
219#define BT_SDP_PRIMARY_LANG_BASE 0x0100
220
221#define BT_SDP_ATTR_SVCNAME_PRIMARY (0x0000 + BT_SDP_PRIMARY_LANG_BASE)
222#define BT_SDP_ATTR_SVCDESC_PRIMARY (0x0001 + BT_SDP_PRIMARY_LANG_BASE)
223#define BT_SDP_ATTR_PROVNAME_PRIMARY (0x0002 + BT_SDP_PRIMARY_LANG_BASE)
224
246#define BT_SDP_DATA_NIL 0x00
247#define BT_SDP_UINT8 0x08
248#define BT_SDP_UINT16 0x09
249#define BT_SDP_UINT32 0x0a
250#define BT_SDP_UINT64 0x0b
251#define BT_SDP_UINT128 0x0c
252#define BT_SDP_INT8 0x10
253#define BT_SDP_INT16 0x11
254#define BT_SDP_INT32 0x12
255#define BT_SDP_INT64 0x13
256#define BT_SDP_INT128 0x14
257#define BT_SDP_UUID_UNSPEC 0x18
258#define BT_SDP_UUID16 0x19
259#define BT_SDP_UUID32 0x1a
260#define BT_SDP_UUID128 0x1c
261#define BT_SDP_TEXT_STR_UNSPEC 0x20
262#define BT_SDP_TEXT_STR8 0x25
263#define BT_SDP_TEXT_STR16 0x26
264#define BT_SDP_TEXT_STR32 0x27
265#define BT_SDP_BOOL 0x28
266#define BT_SDP_SEQ_UNSPEC 0x30
267#define BT_SDP_SEQ8 0x35
268#define BT_SDP_SEQ16 0x36
269#define BT_SDP_SEQ32 0x37
270#define BT_SDP_ALT_UNSPEC 0x38
271#define BT_SDP_ALT8 0x3d
272#define BT_SDP_ALT16 0x3e
273#define BT_SDP_ALT32 0x3f
274#define BT_SDP_URL_STR_UNSPEC 0x40
275#define BT_SDP_URL_STR8 0x45
276#define BT_SDP_URL_STR16 0x46
277#define BT_SDP_URL_STR32 0x47
282#define BT_SDP_TYPE_DESC_MASK 0xf8
283#define BT_SDP_SIZE_DESC_MASK 0x07
284#define BT_SDP_SIZE_INDEX_OFFSET 5
285
293
299
308
309/*
310 * --------------------------------------------------- ------------------
311 * | Service Hdl | Attr list ptr | Attr count | Next | -> | Service Hdl | ...
312 * --------------------------------------------------- ------------------
313 */
314
318#define BT_SDP_ARRAY_8(...) ((uint8_t[]) {__VA_ARGS__})
319
323#define BT_SDP_ARRAY_16(...) ((uint16_t[]) {__VA_ARGS__})
324
328#define BT_SDP_ARRAY_32(...) ((uint32_t[]) {__VA_ARGS__})
329
335#define BT_SDP_TYPE_SIZE(_type) .type = _type, \
336 .data_size = BIT(_type & BT_SDP_SIZE_DESC_MASK), \
337 .total_size = BIT(_type & BT_SDP_SIZE_DESC_MASK) + 1
338
345#define BT_SDP_TYPE_SIZE_VAR(_type, _size) .type = _type, \
346 .data_size = _size, \
347 .total_size = BIT((_type & BT_SDP_SIZE_DESC_MASK) - \
348 BT_SDP_SIZE_INDEX_OFFSET) + _size + 1
349
353#define BT_SDP_DATA_ELEM_LIST(...) ((struct bt_sdp_data_elem[]) {__VA_ARGS__})
354
355
364#define BT_SDP_NEW_SERVICE \
365{ \
366 BT_SDP_ATTR_RECORD_HANDLE, \
367 { BT_SDP_TYPE_SIZE(BT_SDP_UINT32), BT_SDP_ARRAY_32(0) } \
368}, \
369{ \
370 BT_SDP_ATTR_RECORD_STATE, \
371 { BT_SDP_TYPE_SIZE(BT_SDP_UINT32), BT_SDP_ARRAY_32(0) } \
372}, \
373{ \
374 BT_SDP_ATTR_LANG_BASE_ATTR_ID_LIST, \
375 { BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 9), \
376 BT_SDP_DATA_ELEM_LIST( \
377 { BT_SDP_TYPE_SIZE(BT_SDP_UINT16), BT_SDP_ARRAY_8('n', 'e') }, \
378 { BT_SDP_TYPE_SIZE(BT_SDP_UINT16), BT_SDP_ARRAY_16(106) }, \
379 { BT_SDP_TYPE_SIZE(BT_SDP_UINT16), \
380 BT_SDP_ARRAY_16(BT_SDP_PRIMARY_LANG_BASE) } \
381 ), \
382 } \
383}, \
384{ \
385 BT_SDP_ATTR_BROWSE_GRP_LIST, \
386 { BT_SDP_TYPE_SIZE_VAR(BT_SDP_SEQ8, 3), \
387 BT_SDP_DATA_ELEM_LIST( \
388 { BT_SDP_TYPE_SIZE(BT_SDP_UUID16), \
389 BT_SDP_ARRAY_16(BT_SDP_PUBLIC_BROWSE_GROUP) }, \
390 ), \
391 } \
392}
393
394
404#define BT_SDP_LIST(_att_id, _type_size, _data_elem_seq) \
405{ \
406 _att_id, { _type_size, _data_elem_seq } \
407}
408
416#define BT_SDP_SERVICE_ID(_uuid) \
417{ \
418 BT_SDP_ATTR_SERVICE_ID, \
419 { BT_SDP_TYPE_SIZE(BT_SDP_UUID16), &((struct bt_uuid_16) _uuid) } \
420}
421
429#define BT_SDP_SERVICE_NAME(_name) \
430{ \
431 BT_SDP_ATTR_SVCNAME_PRIMARY, \
432 { BT_SDP_TYPE_SIZE_VAR(BT_SDP_TEXT_STR8, (sizeof(_name)-1)), _name } \
433}
434
442#define BT_SDP_SUPPORTED_FEATURES(_features) \
443{ \
444 BT_SDP_ATTR_SUPPORTED_FEATURES, \
445 { BT_SDP_TYPE_SIZE(BT_SDP_UINT16), BT_SDP_ARRAY_16(_features) } \
446}
447
455#define BT_SDP_RECORD(_attrs) \
456{ \
457 .attrs = _attrs, \
458 .attr_count = ARRAY_SIZE((_attrs)), \
459}
460
461/* Server API */
462
475
476/* Client API */
477
487
491enum {
494};
495
524 (struct bt_conn *conn, struct bt_sdp_client_result *result);
525
536
552int bt_sdp_discover(struct bt_conn *conn,
553 const struct bt_sdp_discover_params *params);
554
565int bt_sdp_discover_cancel(struct bt_conn *conn,
566 const struct bt_sdp_discover_params *params);
567
568
569/* Helper types & functions for SDP client to get essential data from server */
570
576
589int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto,
590 uint16_t *param);
591
608int bt_sdp_get_addl_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto,
609 uint8_t param_index, uint16_t *param);
610
623int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile,
624 uint16_t *version);
625
636int bt_sdp_get_features(const struct net_buf *buf, uint16_t *features);
637
638#ifdef __cplusplus
639}
640#endif
641
646#endif /* ZEPHYR_INCLUDE_BLUETOOTH_SDP_H_ */
Bluetooth connection handling.
int bt_sdp_discover_cancel(struct bt_conn *conn, const struct bt_sdp_discover_params *params)
Release waiting SDP discovery request.
int bt_sdp_register_service(struct bt_sdp_record *service)
Register a Service Record.
int bt_sdp_get_profile_version(const struct net_buf *buf, uint16_t profile, uint16_t *version)
Get profile version.
int bt_sdp_get_addl_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, uint8_t param_index, uint16_t *param)
Get additional parameter value related to given stacked protocol UUID.
int bt_sdp_get_features(const struct net_buf *buf, uint16_t *features)
Get SupportedFeatures attribute value.
uint8_t(* bt_sdp_discover_func_t)(struct bt_conn *conn, struct bt_sdp_client_result *result)
Callback type reporting to user that there is a resolved result on remote for given UUID and the resu...
Definition sdp.h:524
bt_sdp_proto
Protocols to be asked about specific parameters.
Definition sdp.h:572
int bt_sdp_discover(struct bt_conn *conn, const struct bt_sdp_discover_params *params)
Allows user to start SDP discovery session.
int bt_sdp_get_proto_param(const struct net_buf *buf, enum bt_sdp_proto proto, uint16_t *param)
Give to user parameter value related to given stacked protocol UUID.
@ BT_SDP_DISCOVER_UUID_CONTINUE
Definition sdp.h:493
@ BT_SDP_DISCOVER_UUID_STOP
Definition sdp.h:492
@ BT_SDP_PROTO_L2CAP
Definition sdp.h:574
@ BT_SDP_PROTO_RFCOMM
Definition sdp.h:573
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
SDP Attribute Value.
Definition sdp.h:295
uint16_t id
Attribute ID.
Definition sdp.h:296
struct bt_sdp_data_elem val
Attribute data.
Definition sdp.h:297
Generic SDP Client Query Result data holder.
Definition sdp.h:479
bool next_record_hint
flag pointing that there are more result chunks for given UUID
Definition sdp.h:483
struct net_buf * resp_buf
buffer containing unparsed SDP record result for given UUID
Definition sdp.h:481
const struct bt_uuid * uuid
Reference to UUID object on behalf one discovery was started.
Definition sdp.h:485
SDP Generic Data Element Value.
Definition sdp.h:287
const void * data
Definition sdp.h:291
uint32_t data_size
Size of the data element.
Definition sdp.h:289
uint32_t total_size
Total size of the data element.
Definition sdp.h:290
uint8_t type
Type of the data element.
Definition sdp.h:288
Main user structure used in SDP discovery of remote.
Definition sdp.h:527
const struct bt_uuid * uuid
UUID (service) to be discovered on remote SDP entity.
Definition sdp.h:530
bt_sdp_discover_func_t func
Discover callback to be called on resolved SDP record.
Definition sdp.h:532
struct net_buf_pool * pool
Memory buffer enabled by user for SDP query results
Definition sdp.h:534
SDP Service Record Value.
Definition sdp.h:301
size_t attr_count
Number of attributes.
Definition sdp.h:304
struct bt_sdp_record * next
Next service record.
Definition sdp.h:306
uint8_t index
Index of the record in LL.
Definition sdp.h:305
struct bt_sdp_attribute * attrs
Base addr of attr array.
Definition sdp.h:303
uint32_t handle
Redundant, for quick ref.
Definition sdp.h:302
This is a 'tentative' type and should be used as a pointer only.
Definition uuid.h:49
Network buffer pool representation.
Definition net_buf.h:1078
Network buffer representation.
Definition net_buf.h:1006
Bluetooth UUID handling.