sdp.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. /*
  2. *
  3. * BlueZ - Bluetooth protocol stack for Linux
  4. *
  5. * Copyright (C) 2001-2002 Nokia Corporation
  6. * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
  7. * Copyright (C) 2002-2010 Marcel Holtmann <marcel@holtmann.org>
  8. * Copyright (C) 2002-2003 Stephen Crane <steve.crane@rococosoft.com>
  9. *
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  24. *
  25. */
  26. #ifndef __SDP_H
  27. #define __SDP_H
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #include <stdint.h>
  32. #include <bluetooth/bluetooth.h>
  33. #define SDP_UNIX_PATH "/var/run/sdp"
  34. #define SDP_RESPONSE_TIMEOUT 20
  35. #define SDP_REQ_BUFFER_SIZE 2048
  36. #define SDP_RSP_BUFFER_SIZE 65535
  37. #define SDP_PDU_CHUNK_SIZE 1024
  38. /*
  39. * All definitions are based on Bluetooth Assigned Numbers
  40. * of the Bluetooth Specification
  41. */
  42. #define SDP_PSM 0x0001
  43. /*
  44. * Protocol UUIDs
  45. */
  46. #define SDP_UUID 0x0001
  47. #define UDP_UUID 0x0002
  48. #define RFCOMM_UUID 0x0003
  49. #define TCP_UUID 0x0004
  50. #define TCS_BIN_UUID 0x0005
  51. #define TCS_AT_UUID 0x0006
  52. #define ATT_UUID 0x0007
  53. #define OBEX_UUID 0x0008
  54. #define IP_UUID 0x0009
  55. #define FTP_UUID 0x000a
  56. #define HTTP_UUID 0x000c
  57. #define WSP_UUID 0x000e
  58. #define BNEP_UUID 0x000f
  59. #define UPNP_UUID 0x0010
  60. #define HIDP_UUID 0x0011
  61. #define HCRP_CTRL_UUID 0x0012
  62. #define HCRP_DATA_UUID 0x0014
  63. #define HCRP_NOTE_UUID 0x0016
  64. #define AVCTP_UUID 0x0017
  65. #define AVDTP_UUID 0x0019
  66. #define CMTP_UUID 0x001b
  67. #define UDI_UUID 0x001d
  68. #define MCAP_CTRL_UUID 0x001e
  69. #define MCAP_DATA_UUID 0x001f
  70. #define L2CAP_UUID 0x0100
  71. /*
  72. * Service class identifiers of standard services and service groups
  73. */
  74. #define SDP_SERVER_SVCLASS_ID 0x1000
  75. #define BROWSE_GRP_DESC_SVCLASS_ID 0x1001
  76. #define PUBLIC_BROWSE_GROUP 0x1002
  77. #define SERIAL_PORT_SVCLASS_ID 0x1101
  78. #define LAN_ACCESS_SVCLASS_ID 0x1102
  79. #define DIALUP_NET_SVCLASS_ID 0x1103
  80. #define IRMC_SYNC_SVCLASS_ID 0x1104
  81. #define OBEX_OBJPUSH_SVCLASS_ID 0x1105
  82. #define OBEX_FILETRANS_SVCLASS_ID 0x1106
  83. #define IRMC_SYNC_CMD_SVCLASS_ID 0x1107
  84. #define HEADSET_SVCLASS_ID 0x1108
  85. #define CORDLESS_TELEPHONY_SVCLASS_ID 0x1109
  86. #define AUDIO_SOURCE_SVCLASS_ID 0x110a
  87. #define AUDIO_SINK_SVCLASS_ID 0x110b
  88. #define AV_REMOTE_TARGET_SVCLASS_ID 0x110c
  89. #define ADVANCED_AUDIO_SVCLASS_ID 0x110d
  90. #define AV_REMOTE_SVCLASS_ID 0x110e
  91. #define AV_REMOTE_CONTROLLER_SVCLASS_ID 0x110f
  92. #define INTERCOM_SVCLASS_ID 0x1110
  93. #define FAX_SVCLASS_ID 0x1111
  94. #define HEADSET_AGW_SVCLASS_ID 0x1112
  95. #define WAP_SVCLASS_ID 0x1113
  96. #define WAP_CLIENT_SVCLASS_ID 0x1114
  97. #define PANU_SVCLASS_ID 0x1115
  98. #define NAP_SVCLASS_ID 0x1116
  99. #define GN_SVCLASS_ID 0x1117
  100. #define DIRECT_PRINTING_SVCLASS_ID 0x1118
  101. #define REFERENCE_PRINTING_SVCLASS_ID 0x1119
  102. #define IMAGING_SVCLASS_ID 0x111a
  103. #define IMAGING_RESPONDER_SVCLASS_ID 0x111b
  104. #define IMAGING_ARCHIVE_SVCLASS_ID 0x111c
  105. #define IMAGING_REFOBJS_SVCLASS_ID 0x111d
  106. #define HANDSFREE_SVCLASS_ID 0x111e
  107. #define HANDSFREE_AGW_SVCLASS_ID 0x111f
  108. #define DIRECT_PRT_REFOBJS_SVCLASS_ID 0x1120
  109. #define REFLECTED_UI_SVCLASS_ID 0x1121
  110. #define BASIC_PRINTING_SVCLASS_ID 0x1122
  111. #define PRINTING_STATUS_SVCLASS_ID 0x1123
  112. #define HID_SVCLASS_ID 0x1124
  113. #define HCR_SVCLASS_ID 0x1125
  114. #define HCR_PRINT_SVCLASS_ID 0x1126
  115. #define HCR_SCAN_SVCLASS_ID 0x1127
  116. #define CIP_SVCLASS_ID 0x1128
  117. #define VIDEO_CONF_GW_SVCLASS_ID 0x1129
  118. #define UDI_MT_SVCLASS_ID 0x112a
  119. #define UDI_TA_SVCLASS_ID 0x112b
  120. #define AV_SVCLASS_ID 0x112c
  121. #define SAP_SVCLASS_ID 0x112d
  122. #define PBAP_PCE_SVCLASS_ID 0x112e
  123. #define PBAP_PSE_SVCLASS_ID 0x112f
  124. #define PBAP_SVCLASS_ID 0x1130
  125. #define MAP_MSE_SVCLASS_ID 0x1132
  126. #define MAP_MCE_SVCLASS_ID 0x1133
  127. #define MAP_SVCLASS_ID 0x1134
  128. #define GNSS_SVCLASS_ID 0x1135
  129. #define GNSS_SERVER_SVCLASS_ID 0x1136
  130. #define MPS_SC_SVCLASS_ID 0x113A
  131. #define MPS_SVCLASS_ID 0x113B
  132. #define PNP_INFO_SVCLASS_ID 0x1200
  133. #define GENERIC_NETWORKING_SVCLASS_ID 0x1201
  134. #define GENERIC_FILETRANS_SVCLASS_ID 0x1202
  135. #define GENERIC_AUDIO_SVCLASS_ID 0x1203
  136. #define GENERIC_TELEPHONY_SVCLASS_ID 0x1204
  137. #define UPNP_SVCLASS_ID 0x1205
  138. #define UPNP_IP_SVCLASS_ID 0x1206
  139. #define UPNP_PAN_SVCLASS_ID 0x1300
  140. #define UPNP_LAP_SVCLASS_ID 0x1301
  141. #define UPNP_L2CAP_SVCLASS_ID 0x1302
  142. #define VIDEO_SOURCE_SVCLASS_ID 0x1303
  143. #define VIDEO_SINK_SVCLASS_ID 0x1304
  144. #define VIDEO_DISTRIBUTION_SVCLASS_ID 0x1305
  145. #define HDP_SVCLASS_ID 0x1400
  146. #define HDP_SOURCE_SVCLASS_ID 0x1401
  147. #define HDP_SINK_SVCLASS_ID 0x1402
  148. #define GENERIC_ACCESS_SVCLASS_ID 0x1800
  149. #define GENERIC_ATTRIB_SVCLASS_ID 0x1801
  150. #define APPLE_AGENT_SVCLASS_ID 0x2112
  151. /*
  152. * Standard profile descriptor identifiers; note these
  153. * may be identical to some of the service classes defined above
  154. */
  155. #define SDP_SERVER_PROFILE_ID SDP_SERVER_SVCLASS_ID
  156. #define BROWSE_GRP_DESC_PROFILE_ID BROWSE_GRP_DESC_SVCLASS_ID
  157. #define SERIAL_PORT_PROFILE_ID SERIAL_PORT_SVCLASS_ID
  158. #define LAN_ACCESS_PROFILE_ID LAN_ACCESS_SVCLASS_ID
  159. #define DIALUP_NET_PROFILE_ID DIALUP_NET_SVCLASS_ID
  160. #define IRMC_SYNC_PROFILE_ID IRMC_SYNC_SVCLASS_ID
  161. #define OBEX_OBJPUSH_PROFILE_ID OBEX_OBJPUSH_SVCLASS_ID
  162. #define OBEX_FILETRANS_PROFILE_ID OBEX_FILETRANS_SVCLASS_ID
  163. #define IRMC_SYNC_CMD_PROFILE_ID IRMC_SYNC_CMD_SVCLASS_ID
  164. #define HEADSET_PROFILE_ID HEADSET_SVCLASS_ID
  165. #define CORDLESS_TELEPHONY_PROFILE_ID CORDLESS_TELEPHONY_SVCLASS_ID
  166. #define AUDIO_SOURCE_PROFILE_ID AUDIO_SOURCE_SVCLASS_ID
  167. #define AUDIO_SINK_PROFILE_ID AUDIO_SINK_SVCLASS_ID
  168. #define AV_REMOTE_TARGET_PROFILE_ID AV_REMOTE_TARGET_SVCLASS_ID
  169. #define ADVANCED_AUDIO_PROFILE_ID ADVANCED_AUDIO_SVCLASS_ID
  170. #define AV_REMOTE_PROFILE_ID AV_REMOTE_SVCLASS_ID
  171. #define VIDEO_CONF_PROFILE_ID VIDEO_CONF_SVCLASS_ID
  172. #define INTERCOM_PROFILE_ID INTERCOM_SVCLASS_ID
  173. #define FAX_PROFILE_ID FAX_SVCLASS_ID
  174. #define HEADSET_AGW_PROFILE_ID HEADSET_AGW_SVCLASS_ID
  175. #define WAP_PROFILE_ID WAP_SVCLASS_ID
  176. #define WAP_CLIENT_PROFILE_ID WAP_CLIENT_SVCLASS_ID
  177. #define PANU_PROFILE_ID PANU_SVCLASS_ID
  178. #define NAP_PROFILE_ID NAP_SVCLASS_ID
  179. #define GN_PROFILE_ID GN_SVCLASS_ID
  180. #define DIRECT_PRINTING_PROFILE_ID DIRECT_PRINTING_SVCLASS_ID
  181. #define REFERENCE_PRINTING_PROFILE_ID REFERENCE_PRINTING_SVCLASS_ID
  182. #define IMAGING_PROFILE_ID IMAGING_SVCLASS_ID
  183. #define IMAGING_RESPONDER_PROFILE_ID IMAGING_RESPONDER_SVCLASS_ID
  184. #define IMAGING_ARCHIVE_PROFILE_ID IMAGING_ARCHIVE_SVCLASS_ID
  185. #define IMAGING_REFOBJS_PROFILE_ID IMAGING_REFOBJS_SVCLASS_ID
  186. #define HANDSFREE_PROFILE_ID HANDSFREE_SVCLASS_ID
  187. #define HANDSFREE_AGW_PROFILE_ID HANDSFREE_AGW_SVCLASS_ID
  188. #define DIRECT_PRT_REFOBJS_PROFILE_ID DIRECT_PRT_REFOBJS_SVCLASS_ID
  189. #define REFLECTED_UI_PROFILE_ID REFLECTED_UI_SVCLASS_ID
  190. #define BASIC_PRINTING_PROFILE_ID BASIC_PRINTING_SVCLASS_ID
  191. #define PRINTING_STATUS_PROFILE_ID PRINTING_STATUS_SVCLASS_ID
  192. #define HID_PROFILE_ID HID_SVCLASS_ID
  193. #define HCR_PROFILE_ID HCR_SCAN_SVCLASS_ID
  194. #define HCR_PRINT_PROFILE_ID HCR_PRINT_SVCLASS_ID
  195. #define HCR_SCAN_PROFILE_ID HCR_SCAN_SVCLASS_ID
  196. #define CIP_PROFILE_ID CIP_SVCLASS_ID
  197. #define VIDEO_CONF_GW_PROFILE_ID VIDEO_CONF_GW_SVCLASS_ID
  198. #define UDI_MT_PROFILE_ID UDI_MT_SVCLASS_ID
  199. #define UDI_TA_PROFILE_ID UDI_TA_SVCLASS_ID
  200. #define AV_PROFILE_ID AV_SVCLASS_ID
  201. #define SAP_PROFILE_ID SAP_SVCLASS_ID
  202. #define PBAP_PCE_PROFILE_ID PBAP_PCE_SVCLASS_ID
  203. #define PBAP_PSE_PROFILE_ID PBAP_PSE_SVCLASS_ID
  204. #define PBAP_PROFILE_ID PBAP_SVCLASS_ID
  205. #define MAP_PROFILE_ID MAP_SVCLASS_ID
  206. #define PNP_INFO_PROFILE_ID PNP_INFO_SVCLASS_ID
  207. #define GENERIC_NETWORKING_PROFILE_ID GENERIC_NETWORKING_SVCLASS_ID
  208. #define GENERIC_FILETRANS_PROFILE_ID GENERIC_FILETRANS_SVCLASS_ID
  209. #define GENERIC_AUDIO_PROFILE_ID GENERIC_AUDIO_SVCLASS_ID
  210. #define GENERIC_TELEPHONY_PROFILE_ID GENERIC_TELEPHONY_SVCLASS_ID
  211. #define UPNP_PROFILE_ID UPNP_SVCLASS_ID
  212. #define UPNP_IP_PROFILE_ID UPNP_IP_SVCLASS_ID
  213. #define UPNP_PAN_PROFILE_ID UPNP_PAN_SVCLASS_ID
  214. #define UPNP_LAP_PROFILE_ID UPNP_LAP_SVCLASS_ID
  215. #define UPNP_L2CAP_PROFILE_ID UPNP_L2CAP_SVCLASS_ID
  216. #define VIDEO_SOURCE_PROFILE_ID VIDEO_SOURCE_SVCLASS_ID
  217. #define VIDEO_SINK_PROFILE_ID VIDEO_SINK_SVCLASS_ID
  218. #define VIDEO_DISTRIBUTION_PROFILE_ID VIDEO_DISTRIBUTION_SVCLASS_ID
  219. #define HDP_PROFILE_ID HDP_SVCLASS_ID
  220. #define HDP_SOURCE_PROFILE_ID HDP_SOURCE_SVCLASS_ID
  221. #define HDP_SINK_PROFILE_ID HDP_SINK_SVCLASS_ID
  222. #define GENERIC_ACCESS_PROFILE_ID GENERIC_ACCESS_SVCLASS_ID
  223. #define GENERIC_ATTRIB_PROFILE_ID GENERIC_ATTRIB_SVCLASS_ID
  224. #define APPLE_AGENT_PROFILE_ID APPLE_AGENT_SVCLASS_ID
  225. #define MPS_PROFILE_ID MPS_SC_SVCLASS_ID
  226. /*
  227. * Compatibility macros for the old MDP acronym
  228. */
  229. #define MDP_SVCLASS_ID HDP_SVCLASS_ID
  230. #define MDP_SOURCE_SVCLASS_ID HDP_SOURCE_SVCLASS_ID
  231. #define MDP_SINK_SVCLASS_ID HDP_SINK_SVCLASS_ID
  232. #define MDP_PROFILE_ID HDP_PROFILE_ID
  233. #define MDP_SOURCE_PROFILE_ID HDP_SOURCE_PROFILE_ID
  234. #define MDP_SINK_PROFILE_ID HDP_SINK_PROFILE_ID
  235. /*
  236. * Attribute identifier codes
  237. */
  238. #define SDP_SERVER_RECORD_HANDLE 0x0000
  239. /*
  240. * Possible values for attribute-id are listed below.
  241. * See SDP Spec, section "Service Attribute Definitions" for more details.
  242. */
  243. #define SDP_ATTR_RECORD_HANDLE 0x0000
  244. #define SDP_ATTR_SVCLASS_ID_LIST 0x0001
  245. #define SDP_ATTR_RECORD_STATE 0x0002
  246. #define SDP_ATTR_SERVICE_ID 0x0003
  247. #define SDP_ATTR_PROTO_DESC_LIST 0x0004
  248. #define SDP_ATTR_BROWSE_GRP_LIST 0x0005
  249. #define SDP_ATTR_LANG_BASE_ATTR_ID_LIST 0x0006
  250. #define SDP_ATTR_SVCINFO_TTL 0x0007
  251. #define SDP_ATTR_SERVICE_AVAILABILITY 0x0008
  252. #define SDP_ATTR_PFILE_DESC_LIST 0x0009
  253. #define SDP_ATTR_DOC_URL 0x000a
  254. #define SDP_ATTR_CLNT_EXEC_URL 0x000b
  255. #define SDP_ATTR_ICON_URL 0x000c
  256. #define SDP_ATTR_ADD_PROTO_DESC_LIST 0x000d
  257. #define SDP_ATTR_GROUP_ID 0x0200
  258. #define SDP_ATTR_IP_SUBNET 0x0200
  259. #define SDP_ATTR_VERSION_NUM_LIST 0x0200
  260. #define SDP_ATTR_SUPPORTED_FEATURES_LIST 0x0200
  261. #define SDP_ATTR_GOEP_L2CAP_PSM 0x0200
  262. #define SDP_ATTR_SVCDB_STATE 0x0201
  263. #define SDP_ATTR_MPSD_SCENARIOS 0x0200
  264. #define SDP_ATTR_MPMD_SCENARIOS 0x0201
  265. #define SDP_ATTR_MPS_DEPENDENCIES 0x0202
  266. #define SDP_ATTR_SERVICE_VERSION 0x0300
  267. #define SDP_ATTR_EXTERNAL_NETWORK 0x0301
  268. #define SDP_ATTR_SUPPORTED_DATA_STORES_LIST 0x0301
  269. #define SDP_ATTR_DATA_EXCHANGE_SPEC 0x0301
  270. #define SDP_ATTR_NETWORK 0x0301
  271. #define SDP_ATTR_FAX_CLASS1_SUPPORT 0x0302
  272. #define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL 0x0302
  273. #define SDP_ATTR_MCAP_SUPPORTED_PROCEDURES 0x0302
  274. #define SDP_ATTR_FAX_CLASS20_SUPPORT 0x0303
  275. #define SDP_ATTR_SUPPORTED_FORMATS_LIST 0x0303
  276. #define SDP_ATTR_FAX_CLASS2_SUPPORT 0x0304
  277. #define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT 0x0305
  278. #define SDP_ATTR_NETWORK_ADDRESS 0x0306
  279. #define SDP_ATTR_WAP_GATEWAY 0x0307
  280. #define SDP_ATTR_HOMEPAGE_URL 0x0308
  281. #define SDP_ATTR_WAP_STACK_TYPE 0x0309
  282. #define SDP_ATTR_SECURITY_DESC 0x030a
  283. #define SDP_ATTR_NET_ACCESS_TYPE 0x030b
  284. #define SDP_ATTR_MAX_NET_ACCESSRATE 0x030c
  285. #define SDP_ATTR_IP4_SUBNET 0x030d
  286. #define SDP_ATTR_IP6_SUBNET 0x030e
  287. #define SDP_ATTR_SUPPORTED_CAPABILITIES 0x0310
  288. #define SDP_ATTR_SUPPORTED_FEATURES 0x0311
  289. #define SDP_ATTR_SUPPORTED_FUNCTIONS 0x0312
  290. #define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY 0x0313
  291. #define SDP_ATTR_SUPPORTED_REPOSITORIES 0x0314
  292. #define SDP_ATTR_MAS_INSTANCE_ID 0x0315
  293. #define SDP_ATTR_SUPPORTED_MESSAGE_TYPES 0x0316
  294. #define SDP_ATTR_PBAP_SUPPORTED_FEATURES 0x0317
  295. #define SDP_ATTR_MAP_SUPPORTED_FEATURES 0x0317
  296. #define SDP_ATTR_SPECIFICATION_ID 0x0200
  297. #define SDP_ATTR_VENDOR_ID 0x0201
  298. #define SDP_ATTR_PRODUCT_ID 0x0202
  299. #define SDP_ATTR_VERSION 0x0203
  300. #define SDP_ATTR_PRIMARY_RECORD 0x0204
  301. #define SDP_ATTR_VENDOR_ID_SOURCE 0x0205
  302. #define SDP_ATTR_HID_DEVICE_RELEASE_NUMBER 0x0200
  303. #define SDP_ATTR_HID_PARSER_VERSION 0x0201
  304. #define SDP_ATTR_HID_DEVICE_SUBCLASS 0x0202
  305. #define SDP_ATTR_HID_COUNTRY_CODE 0x0203
  306. #define SDP_ATTR_HID_VIRTUAL_CABLE 0x0204
  307. #define SDP_ATTR_HID_RECONNECT_INITIATE 0x0205
  308. #define SDP_ATTR_HID_DESCRIPTOR_LIST 0x0206
  309. #define SDP_ATTR_HID_LANG_ID_BASE_LIST 0x0207
  310. #define SDP_ATTR_HID_SDP_DISABLE 0x0208
  311. #define SDP_ATTR_HID_BATTERY_POWER 0x0209
  312. #define SDP_ATTR_HID_REMOTE_WAKEUP 0x020a
  313. #define SDP_ATTR_HID_PROFILE_VERSION 0x020b
  314. #define SDP_ATTR_HID_SUPERVISION_TIMEOUT 0x020c
  315. #define SDP_ATTR_HID_NORMALLY_CONNECTABLE 0x020d
  316. #define SDP_ATTR_HID_BOOT_DEVICE 0x020e
  317. /*
  318. * These identifiers are based on the SDP spec stating that
  319. * "base attribute id of the primary (universal) language must be 0x0100"
  320. *
  321. * Other languages should have their own offset; e.g.:
  322. * #define XXXLangBase yyyy
  323. * #define AttrServiceName_XXX 0x0000+XXXLangBase
  324. */
  325. #define SDP_PRIMARY_LANG_BASE 0x0100
  326. #define SDP_ATTR_SVCNAME_PRIMARY 0x0000 + SDP_PRIMARY_LANG_BASE
  327. #define SDP_ATTR_SVCDESC_PRIMARY 0x0001 + SDP_PRIMARY_LANG_BASE
  328. #define SDP_ATTR_PROVNAME_PRIMARY 0x0002 + SDP_PRIMARY_LANG_BASE
  329. /*
  330. * The Data representation in SDP PDUs (pps 339, 340 of BT SDP Spec)
  331. * These are the exact data type+size descriptor values
  332. * that go into the PDU buffer.
  333. *
  334. * The datatype (leading 5bits) + size descriptor (last 3 bits)
  335. * is 8 bits. The size descriptor is critical to extract the
  336. * right number of bytes for the data value from the PDU.
  337. *
  338. * For most basic types, the datatype+size descriptor is
  339. * straightforward. However for constructed types and strings,
  340. * the size of the data is in the next "n" bytes following the
  341. * 8 bits (datatype+size) descriptor. Exactly what the "n" is
  342. * specified in the 3 bits of the data size descriptor.
  343. *
  344. * TextString and URLString can be of size 2^{8, 16, 32} bytes
  345. * DataSequence and DataSequenceAlternates can be of size 2^{8, 16, 32}
  346. * The size are computed post-facto in the API and are not known apriori
  347. */
  348. #define SDP_DATA_NIL 0x00
  349. #define SDP_UINT8 0x08
  350. #define SDP_UINT16 0x09
  351. #define SDP_UINT32 0x0A
  352. #define SDP_UINT64 0x0B
  353. #define SDP_UINT128 0x0C
  354. #define SDP_INT8 0x10
  355. #define SDP_INT16 0x11
  356. #define SDP_INT32 0x12
  357. #define SDP_INT64 0x13
  358. #define SDP_INT128 0x14
  359. #define SDP_UUID_UNSPEC 0x18
  360. #define SDP_UUID16 0x19
  361. #define SDP_UUID32 0x1A
  362. #define SDP_UUID128 0x1C
  363. #define SDP_TEXT_STR_UNSPEC 0x20
  364. #define SDP_TEXT_STR8 0x25
  365. #define SDP_TEXT_STR16 0x26
  366. #define SDP_TEXT_STR32 0x27
  367. #define SDP_BOOL 0x28
  368. #define SDP_SEQ_UNSPEC 0x30
  369. #define SDP_SEQ8 0x35
  370. #define SDP_SEQ16 0x36
  371. #define SDP_SEQ32 0x37
  372. #define SDP_ALT_UNSPEC 0x38
  373. #define SDP_ALT8 0x3D
  374. #define SDP_ALT16 0x3E
  375. #define SDP_ALT32 0x3F
  376. #define SDP_URL_STR_UNSPEC 0x40
  377. #define SDP_URL_STR8 0x45
  378. #define SDP_URL_STR16 0x46
  379. #define SDP_URL_STR32 0x47
  380. /*
  381. * The PDU identifiers of SDP packets between client and server
  382. */
  383. #define SDP_ERROR_RSP 0x01
  384. #define SDP_SVC_SEARCH_REQ 0x02
  385. #define SDP_SVC_SEARCH_RSP 0x03
  386. #define SDP_SVC_ATTR_REQ 0x04
  387. #define SDP_SVC_ATTR_RSP 0x05
  388. #define SDP_SVC_SEARCH_ATTR_REQ 0x06
  389. #define SDP_SVC_SEARCH_ATTR_RSP 0x07
  390. /*
  391. * Some additions to support service registration.
  392. * These are outside the scope of the Bluetooth specification
  393. */
  394. #define SDP_SVC_REGISTER_REQ 0x75
  395. #define SDP_SVC_REGISTER_RSP 0x76
  396. #define SDP_SVC_UPDATE_REQ 0x77
  397. #define SDP_SVC_UPDATE_RSP 0x78
  398. #define SDP_SVC_REMOVE_REQ 0x79
  399. #define SDP_SVC_REMOVE_RSP 0x80
  400. /*
  401. * SDP Error codes
  402. */
  403. #define SDP_INVALID_VERSION 0x0001
  404. #define SDP_INVALID_RECORD_HANDLE 0x0002
  405. #define SDP_INVALID_SYNTAX 0x0003
  406. #define SDP_INVALID_PDU_SIZE 0x0004
  407. #define SDP_INVALID_CSTATE 0x0005
  408. /*
  409. * SDP PDU
  410. */
  411. typedef struct {
  412. uint8_t pdu_id;
  413. uint16_t tid;
  414. uint16_t plen;
  415. } __attribute__ ((packed)) sdp_pdu_hdr_t;
  416. /*
  417. * Common definitions for attributes in the SDP.
  418. * Should the type of any of these change, you need only make a change here.
  419. */
  420. typedef struct {
  421. uint8_t type;
  422. union {
  423. uint16_t uuid16;
  424. uint32_t uuid32;
  425. uint128_t uuid128;
  426. } value;
  427. } uuid_t;
  428. #define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || \
  429. (x) == SDP_UUID128)
  430. #define SDP_IS_ALT(x) ((x) == SDP_ALT8 || (x) == SDP_ALT16 || (x) == SDP_ALT32)
  431. #define SDP_IS_SEQ(x) ((x) == SDP_SEQ8 || (x) == SDP_SEQ16 || (x) == SDP_SEQ32)
  432. #define SDP_IS_TEXT_STR(x) ((x) == SDP_TEXT_STR8 || (x) == SDP_TEXT_STR16 || \
  433. (x) == SDP_TEXT_STR32)
  434. typedef struct _sdp_list sdp_list_t;
  435. struct _sdp_list {
  436. sdp_list_t *next;
  437. void *data;
  438. };
  439. /*
  440. * User-visible strings can be in many languages
  441. * in addition to the universal language.
  442. *
  443. * Language meta-data includes language code in ISO639
  444. * followed by the encoding format. The third field in this
  445. * structure is the attribute offset for the language.
  446. * User-visible strings in the specified language can be
  447. * obtained at this offset.
  448. */
  449. typedef struct {
  450. uint16_t code_ISO639;
  451. uint16_t encoding;
  452. uint16_t base_offset;
  453. } sdp_lang_attr_t;
  454. /*
  455. * Profile descriptor is the Bluetooth profile metadata. If a
  456. * service conforms to a well-known profile, then its profile
  457. * identifier (UUID) is an attribute of the service. In addition,
  458. * if the profile has a version number it is specified here.
  459. */
  460. typedef struct {
  461. uuid_t uuid;
  462. uint16_t version;
  463. } sdp_profile_desc_t;
  464. typedef struct {
  465. uint8_t major;
  466. uint8_t minor;
  467. } sdp_version_t;
  468. typedef struct {
  469. uint8_t *data;
  470. uint32_t data_size;
  471. uint32_t buf_size;
  472. } sdp_buf_t;
  473. typedef struct {
  474. uint32_t handle;
  475. /* Search pattern: a sequence of all UUIDs seen in this record */
  476. sdp_list_t *pattern;
  477. sdp_list_t *attrlist;
  478. /* Main service class for Extended Inquiry Response */
  479. uuid_t svclass;
  480. } sdp_record_t;
  481. typedef struct sdp_data_struct sdp_data_t;
  482. struct sdp_data_struct {
  483. uint8_t dtd;
  484. uint16_t attrId;
  485. union {
  486. int8_t int8;
  487. int16_t int16;
  488. int32_t int32;
  489. int64_t int64;
  490. uint128_t int128;
  491. uint8_t uint8;
  492. uint16_t uint16;
  493. uint32_t uint32;
  494. uint64_t uint64;
  495. uint128_t uint128;
  496. uuid_t uuid;
  497. char *str;
  498. sdp_data_t *dataseq;
  499. } val;
  500. sdp_data_t *next;
  501. int unitSize;
  502. };
  503. #ifdef __cplusplus
  504. }
  505. #endif
  506. #endif /* __SDP_H */