Initialize Tizen 2.3
[framework/connectivity/bluez.git] / mobile / lib / sdp.h
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
27 #ifndef __SDP_H
28 #define __SDP_H
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include <stdint.h>
35 #include <bluetooth/bluetooth.h>
36
37 #define SDP_UNIX_PATH "/var/run/sdp"
38 #define SDP_RESPONSE_TIMEOUT    20
39 #define SDP_REQ_BUFFER_SIZE     2048
40 #define SDP_RSP_BUFFER_SIZE     65535
41 #define SDP_PDU_CHUNK_SIZE      1024
42
43 /*
44  * All definitions are based on Bluetooth Assigned Numbers
45  * of the Bluetooth Specification
46  */
47 #define SDP_PSM         0x0001
48
49 /*
50  * Protocol UUIDs
51  */
52 #define SDP_UUID        0x0001
53 #define UDP_UUID        0x0002
54 #define RFCOMM_UUID     0x0003
55 #define TCP_UUID        0x0004
56 #define TCS_BIN_UUID    0x0005
57 #define TCS_AT_UUID     0x0006
58 #define ATT_UUID        0x0007
59 #define OBEX_UUID       0x0008
60 #define IP_UUID         0x0009
61 #define FTP_UUID        0x000a
62 #define HTTP_UUID       0x000c
63 #define WSP_UUID        0x000e
64 #define BNEP_UUID       0x000f
65 #define UPNP_UUID       0x0010
66 #define HIDP_UUID       0x0011
67 #define HCRP_CTRL_UUID  0x0012
68 #define HCRP_DATA_UUID  0x0014
69 #define HCRP_NOTE_UUID  0x0016
70 #define AVCTP_UUID      0x0017
71 #define AVDTP_UUID      0x0019
72 #define CMTP_UUID       0x001b
73 #define UDI_UUID        0x001d
74 #define MCAP_CTRL_UUID  0x001e
75 #define MCAP_DATA_UUID  0x001f
76 #define L2CAP_UUID      0x0100
77
78 /*
79  * Service class identifiers of standard services and service groups
80  */
81 #define SDP_SERVER_SVCLASS_ID           0x1000
82 #define BROWSE_GRP_DESC_SVCLASS_ID      0x1001
83 #define PUBLIC_BROWSE_GROUP             0x1002
84 #define SERIAL_PORT_SVCLASS_ID          0x1101
85 #define LAN_ACCESS_SVCLASS_ID           0x1102
86 #define DIALUP_NET_SVCLASS_ID           0x1103
87 #define IRMC_SYNC_SVCLASS_ID            0x1104
88 #define OBEX_OBJPUSH_SVCLASS_ID         0x1105
89 #define OBEX_FILETRANS_SVCLASS_ID       0x1106
90 #define IRMC_SYNC_CMD_SVCLASS_ID        0x1107
91 #define HEADSET_SVCLASS_ID              0x1108
92 #define CORDLESS_TELEPHONY_SVCLASS_ID   0x1109
93 #define AUDIO_SOURCE_SVCLASS_ID         0x110a
94 #define AUDIO_SINK_SVCLASS_ID           0x110b
95 #define AV_REMOTE_TARGET_SVCLASS_ID     0x110c
96 #define ADVANCED_AUDIO_SVCLASS_ID       0x110d
97 #define AV_REMOTE_SVCLASS_ID            0x110e
98 #define VIDEO_CONF_SVCLASS_ID           0x110f
99 #define INTERCOM_SVCLASS_ID             0x1110
100 #define FAX_SVCLASS_ID                  0x1111
101 #define HEADSET_AGW_SVCLASS_ID          0x1112
102 #define WAP_SVCLASS_ID                  0x1113
103 #define WAP_CLIENT_SVCLASS_ID           0x1114
104 #define PANU_SVCLASS_ID                 0x1115
105 #define NAP_SVCLASS_ID                  0x1116
106 #define GN_SVCLASS_ID                   0x1117
107 #define DIRECT_PRINTING_SVCLASS_ID      0x1118
108 #define REFERENCE_PRINTING_SVCLASS_ID   0x1119
109 #define IMAGING_SVCLASS_ID              0x111a
110 #define IMAGING_RESPONDER_SVCLASS_ID    0x111b
111 #define IMAGING_ARCHIVE_SVCLASS_ID      0x111c
112 #define IMAGING_REFOBJS_SVCLASS_ID      0x111d
113 #define HANDSFREE_SVCLASS_ID            0x111e
114 #define HANDSFREE_AGW_SVCLASS_ID        0x111f
115 #define DIRECT_PRT_REFOBJS_SVCLASS_ID   0x1120
116 #define REFLECTED_UI_SVCLASS_ID         0x1121
117 #define BASIC_PRINTING_SVCLASS_ID       0x1122
118 #define PRINTING_STATUS_SVCLASS_ID      0x1123
119 #define HID_SVCLASS_ID                  0x1124
120 #define HCR_SVCLASS_ID                  0x1125
121 #define HCR_PRINT_SVCLASS_ID            0x1126
122 #define HCR_SCAN_SVCLASS_ID             0x1127
123 #define CIP_SVCLASS_ID                  0x1128
124 #define VIDEO_CONF_GW_SVCLASS_ID        0x1129
125 #define UDI_MT_SVCLASS_ID               0x112a
126 #define UDI_TA_SVCLASS_ID               0x112b
127 #define AV_SVCLASS_ID                   0x112c
128 #define SAP_SVCLASS_ID                  0x112d
129 #define PBAP_PCE_SVCLASS_ID             0x112e
130 #define PBAP_PSE_SVCLASS_ID             0x112f
131 #define PBAP_SVCLASS_ID                 0x1130
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 APPLE_AGENT_SVCLASS_ID          0x2112
149 #define GENERIC_ATTRIB_SVCLASS_ID       0x1801
150
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 PNP_INFO_PROFILE_ID             PNP_INFO_SVCLASS_ID
206 #define GENERIC_NETWORKING_PROFILE_ID   GENERIC_NETWORKING_SVCLASS_ID
207 #define GENERIC_FILETRANS_PROFILE_ID    GENERIC_FILETRANS_SVCLASS_ID
208 #define GENERIC_AUDIO_PROFILE_ID        GENERIC_AUDIO_SVCLASS_ID
209 #define GENERIC_TELEPHONY_PROFILE_ID    GENERIC_TELEPHONY_SVCLASS_ID
210 #define UPNP_PROFILE_ID                 UPNP_SVCLASS_ID
211 #define UPNP_IP_PROFILE_ID              UPNP_IP_SVCLASS_ID
212 #define UPNP_PAN_PROFILE_ID             UPNP_PAN_SVCLASS_ID
213 #define UPNP_LAP_PROFILE_ID             UPNP_LAP_SVCLASS_ID
214 #define UPNP_L2CAP_PROFILE_ID           UPNP_L2CAP_SVCLASS_ID
215 #define VIDEO_SOURCE_PROFILE_ID         VIDEO_SOURCE_SVCLASS_ID
216 #define VIDEO_SINK_PROFILE_ID           VIDEO_SINK_SVCLASS_ID
217 #define VIDEO_DISTRIBUTION_PROFILE_ID   VIDEO_DISTRIBUTION_SVCLASS_ID
218 #define HDP_PROFILE_ID                  HDP_SVCLASS_ID
219 #define HDP_SOURCE_PROFILE_ID           HDP_SOURCE_SVCLASS_ID
220 #define HDP_SINK_PROFILE_ID             HDP_SINK_SVCLASS_ID
221 #define APPLE_AGENT_PROFILE_ID          APPLE_AGENT_SVCLASS_ID
222 #define GENERIC_ACCESS_PROFILE_ID       0x1800
223 #define GENERIC_ATTRIB_PROFILE_ID       GENERIC_ATTRIB_SVCLASS_ID
224
225 /*
226  * Compatibility macros for the old MDP acronym
227  */
228 #define MDP_SVCLASS_ID                  HDP_SVCLASS_ID
229 #define MDP_SOURCE_SVCLASS_ID           HDP_SOURCE_SVCLASS_ID
230 #define MDP_SINK_SVCLASS_ID             HDP_SINK_SVCLASS_ID
231 #define MDP_PROFILE_ID                  HDP_PROFILE_ID
232 #define MDP_SOURCE_PROFILE_ID           HDP_SOURCE_PROFILE_ID
233 #define MDP_SINK_PROFILE_ID             HDP_SINK_PROFILE_ID
234
235 /*
236  * Attribute identifier codes
237  */
238 #define SDP_SERVER_RECORD_HANDLE                0x0000
239
240 /*
241  * Possible values for attribute-id are listed below.
242  * See SDP Spec, section "Service Attribute Definitions" for more details.
243  */
244 #define SDP_ATTR_RECORD_HANDLE                  0x0000
245 #define SDP_ATTR_SVCLASS_ID_LIST                0x0001
246 #define SDP_ATTR_RECORD_STATE                   0x0002
247 #define SDP_ATTR_SERVICE_ID                     0x0003
248 #define SDP_ATTR_PROTO_DESC_LIST                0x0004
249 #define SDP_ATTR_BROWSE_GRP_LIST                0x0005
250 #define SDP_ATTR_LANG_BASE_ATTR_ID_LIST         0x0006
251 #define SDP_ATTR_SVCINFO_TTL                    0x0007
252 #define SDP_ATTR_SERVICE_AVAILABILITY           0x0008
253 #define SDP_ATTR_PFILE_DESC_LIST                0x0009
254 #define SDP_ATTR_DOC_URL                        0x000a
255 #define SDP_ATTR_CLNT_EXEC_URL                  0x000b
256 #define SDP_ATTR_ICON_URL                       0x000c
257 #define SDP_ATTR_ADD_PROTO_DESC_LIST            0x000d
258
259 #define SDP_ATTR_GROUP_ID                       0x0200
260 #define SDP_ATTR_IP_SUBNET                      0x0200
261 #define SDP_ATTR_VERSION_NUM_LIST               0x0200
262 #define SDP_ATTR_SUPPORTED_FEATURES_LIST        0x0200
263 #define SDP_ATTR_SVCDB_STATE                    0x0201
264
265 #define SDP_ATTR_SERVICE_VERSION                0x0300
266 #define SDP_ATTR_EXTERNAL_NETWORK               0x0301
267 #define SDP_ATTR_SUPPORTED_DATA_STORES_LIST     0x0301
268 #define SDP_ATTR_DATA_EXCHANGE_SPEC             0x0301
269 #define SDP_ATTR_FAX_CLASS1_SUPPORT             0x0302
270 #define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL    0x0302
271 #define SDP_ATTR_MCAP_SUPPORTED_PROCEDURES      0x0302
272 #define SDP_ATTR_FAX_CLASS20_SUPPORT            0x0303
273 #define SDP_ATTR_SUPPORTED_FORMATS_LIST         0x0303
274 #define SDP_ATTR_FAX_CLASS2_SUPPORT             0x0304
275 #define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT         0x0305
276 #define SDP_ATTR_NETWORK_ADDRESS                0x0306
277 #define SDP_ATTR_WAP_GATEWAY                    0x0307
278 #define SDP_ATTR_HOMEPAGE_URL                   0x0308
279 #define SDP_ATTR_WAP_STACK_TYPE                 0x0309
280 #define SDP_ATTR_SECURITY_DESC                  0x030a
281 #define SDP_ATTR_NET_ACCESS_TYPE                0x030b
282 #define SDP_ATTR_MAX_NET_ACCESSRATE             0x030c
283 #define SDP_ATTR_IP4_SUBNET                     0x030d
284 #define SDP_ATTR_IP6_SUBNET                     0x030e
285 #define SDP_ATTR_SUPPORTED_CAPABILITIES         0x0310
286 #define SDP_ATTR_SUPPORTED_FEATURES             0x0311
287 #define SDP_ATTR_SUPPORTED_FUNCTIONS            0x0312
288 #define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY    0x0313
289 #define SDP_ATTR_SUPPORTED_REPOSITORIES         0x0314
290
291 #define SDP_ATTR_SPECIFICATION_ID               0x0200
292 #define SDP_ATTR_VENDOR_ID                      0x0201
293 #define SDP_ATTR_PRODUCT_ID                     0x0202
294 #define SDP_ATTR_VERSION                        0x0203
295 #define SDP_ATTR_PRIMARY_RECORD                 0x0204
296 #define SDP_ATTR_VENDOR_ID_SOURCE               0x0205
297
298 #define SDP_ATTR_HID_DEVICE_RELEASE_NUMBER      0x0200
299 #define SDP_ATTR_HID_PARSER_VERSION             0x0201
300 #define SDP_ATTR_HID_DEVICE_SUBCLASS            0x0202
301 #define SDP_ATTR_HID_COUNTRY_CODE               0x0203
302 #define SDP_ATTR_HID_VIRTUAL_CABLE              0x0204
303 #define SDP_ATTR_HID_RECONNECT_INITIATE         0x0205
304 #define SDP_ATTR_HID_DESCRIPTOR_LIST            0x0206
305 #define SDP_ATTR_HID_LANG_ID_BASE_LIST          0x0207
306 #define SDP_ATTR_HID_SDP_DISABLE                0x0208
307 #define SDP_ATTR_HID_BATTERY_POWER              0x0209
308 #define SDP_ATTR_HID_REMOTE_WAKEUP              0x020a
309 #define SDP_ATTR_HID_PROFILE_VERSION            0x020b
310 #define SDP_ATTR_HID_SUPERVISION_TIMEOUT        0x020c
311 #define SDP_ATTR_HID_NORMALLY_CONNECTABLE       0x020d
312 #define SDP_ATTR_HID_BOOT_DEVICE                0x020e
313
314 /*
315  * These identifiers are based on the SDP spec stating that
316  * "base attribute id of the primary (universal) language must be 0x0100"
317  *
318  * Other languages should have their own offset; e.g.:
319  * #define XXXLangBase yyyy
320  * #define AttrServiceName_XXX  0x0000+XXXLangBase
321  */
322 #define SDP_PRIMARY_LANG_BASE           0x0100
323
324 #define SDP_ATTR_SVCNAME_PRIMARY        0x0000 + SDP_PRIMARY_LANG_BASE
325 #define SDP_ATTR_SVCDESC_PRIMARY        0x0001 + SDP_PRIMARY_LANG_BASE
326 #define SDP_ATTR_PROVNAME_PRIMARY       0x0002 + SDP_PRIMARY_LANG_BASE
327
328 /*
329  * The Data representation in SDP PDUs (pps 339, 340 of BT SDP Spec)
330  * These are the exact data type+size descriptor values
331  * that go into the PDU buffer.
332  *
333  * The datatype (leading 5bits) + size descriptor (last 3 bits)
334  * is 8 bits. The size descriptor is critical to extract the
335  * right number of bytes for the data value from the PDU.
336  *
337  * For most basic types, the datatype+size descriptor is
338  * straightforward. However for constructed types and strings,
339  * the size of the data is in the next "n" bytes following the
340  * 8 bits (datatype+size) descriptor. Exactly what the "n" is
341  * specified in the 3 bits of the data size descriptor.
342  *
343  * TextString and URLString can be of size 2^{8, 16, 32} bytes
344  * DataSequence and DataSequenceAlternates can be of size 2^{8, 16, 32}
345  * The size are computed post-facto in the API and are not known apriori
346  */
347 #define SDP_DATA_NIL            0x00
348 #define SDP_UINT8               0x08
349 #define SDP_UINT16              0x09
350 #define SDP_UINT32              0x0A
351 #define SDP_UINT64              0x0B
352 #define SDP_UINT128             0x0C
353 #define SDP_INT8                0x10
354 #define SDP_INT16               0x11
355 #define SDP_INT32               0x12
356 #define SDP_INT64               0x13
357 #define SDP_INT128              0x14
358 #define SDP_UUID_UNSPEC         0x18
359 #define SDP_UUID16              0x19
360 #define SDP_UUID32              0x1A
361 #define SDP_UUID128             0x1C
362 #define SDP_TEXT_STR_UNSPEC     0x20
363 #define SDP_TEXT_STR8           0x25
364 #define SDP_TEXT_STR16          0x26
365 #define SDP_TEXT_STR32          0x27
366 #define SDP_BOOL                0x28
367 #define SDP_SEQ_UNSPEC          0x30
368 #define SDP_SEQ8                0x35
369 #define SDP_SEQ16               0x36
370 #define SDP_SEQ32               0x37
371 #define SDP_ALT_UNSPEC          0x38
372 #define SDP_ALT8                0x3D
373 #define SDP_ALT16               0x3E
374 #define SDP_ALT32               0x3F
375 #define SDP_URL_STR_UNSPEC      0x40
376 #define SDP_URL_STR8            0x45
377 #define SDP_URL_STR16           0x46
378 #define SDP_URL_STR32           0x47
379
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 /*
392  * Some additions to support service registration.
393  * These are outside the scope of the Bluetooth specification
394  */
395 #define SDP_SVC_REGISTER_REQ    0x75
396 #define SDP_SVC_REGISTER_RSP    0x76
397 #define SDP_SVC_UPDATE_REQ      0x77
398 #define SDP_SVC_UPDATE_RSP      0x78
399 #define SDP_SVC_REMOVE_REQ      0x79
400 #define SDP_SVC_REMOVE_RSP      0x80
401
402 /*
403  * SDP Error codes
404  */
405 #define SDP_INVALID_VERSION             0x0001
406 #define SDP_INVALID_RECORD_HANDLE       0x0002
407 #define SDP_INVALID_SYNTAX              0x0003
408 #define SDP_INVALID_PDU_SIZE            0x0004
409 #define SDP_INVALID_CSTATE              0x0005
410
411 /*
412  * SDP PDU
413  */
414 typedef struct {
415         uint8_t  pdu_id;
416         uint16_t tid;
417         uint16_t plen;
418 } __attribute__ ((packed)) sdp_pdu_hdr_t;
419
420 /*
421  * Common definitions for attributes in the SDP.
422  * Should the type of any of these change, you need only make a change here.
423  */
424
425 typedef struct {
426         uint8_t type;
427         union {
428                 uint16_t  uuid16;
429                 uint32_t  uuid32;
430                 uint128_t uuid128;
431         } value;
432 } uuid_t;
433
434 #define SDP_IS_UUID(x) ((x) == SDP_UUID16 || (x) == SDP_UUID32 || (x) ==SDP_UUID128)
435 #define SDP_IS_SEQ(x)  ((x) == SDP_SEQ8 || (x) == SDP_SEQ16 || (x) == SDP_SEQ32)
436
437 typedef struct _sdp_list sdp_list_t;
438 struct _sdp_list {
439         sdp_list_t *next;
440         void *data;
441 };
442
443 /*
444  * User-visible strings can be in many languages
445  * in addition to the universal language.
446  *
447  * Language meta-data includes language code in ISO639
448  * followed by the encoding format. The third field in this
449  * structure is the attribute offset for the language.
450  * User-visible strings in the specified language can be
451  * obtained at this offset.
452  */
453 typedef struct {
454         uint16_t code_ISO639;
455         uint16_t encoding;
456         uint16_t base_offset;
457 } sdp_lang_attr_t;
458
459 /*
460  * Profile descriptor is the Bluetooth profile metadata. If a
461  * service conforms to a well-known profile, then its profile
462  * identifier (UUID) is an attribute of the service. In addition,
463  * if the profile has a version number it is specified here.
464  */
465 typedef struct {
466         uuid_t uuid;
467         uint16_t version;
468 } sdp_profile_desc_t;
469
470 typedef struct {
471         uint8_t major;
472         uint8_t minor;
473 } sdp_version_t;
474
475 typedef struct {
476         uint8_t *data;
477         uint32_t data_size;
478         uint32_t buf_size;
479 } sdp_buf_t;
480
481 typedef struct {
482         uint32_t handle;
483
484         /* Search pattern: a sequence of all UUIDs seen in this record */
485         sdp_list_t *pattern;
486         sdp_list_t *attrlist;
487
488         /* Main service class for Extended Inquiry Response */
489         uuid_t svclass;
490 } sdp_record_t;
491
492 typedef struct sdp_data_struct sdp_data_t;
493 struct sdp_data_struct {
494         uint8_t dtd;
495         uint16_t attrId;
496         union {
497                 int8_t    int8;
498                 int16_t   int16;
499                 int32_t   int32;
500                 int64_t   int64;
501                 uint128_t int128;
502                 uint8_t   uint8;
503                 uint16_t  uint16;
504                 uint32_t  uint32;
505                 uint64_t  uint64;
506                 uint128_t uint128;
507                 uuid_t    uuid;
508                 char     *str;
509                 sdp_data_t *dataseq;
510         } val;
511         sdp_data_t *next;
512         int unitSize;
513 };
514
515 #ifdef __cplusplus
516 }
517 #endif
518
519 #endif /* __SDP_H */