sdp.h revision bf336caaf4d6f967474d46cb768e6edc17cc5777
1/*
2   BlueZ - Bluetooth protocol stack for Linux
3   Copyright (C) 2000-2001 Qualcomm Incorporated
4
5   Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License version 2 as
9   published by the Free Software Foundation;
10
11   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14   IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22   SOFTWARE IS DISCLAIMED.
23*/
24
25/*
26	SDP parser.
27	Copyright (C) 2001 Ricky Yuen <ryuen@qualcomm.com>
28*/
29
30/*
31 *  $Id$
32 */
33
34#ifndef __SDP_H
35#define __SDP_H
36
37#define SDP_ERROR_RSP                                  0x01
38#define SDP_SERVICE_SEARCH_REQ                         0x02
39#define SDP_SERVICE_SEARCH_RSP                         0x03
40#define SDP_SERVICE_ATTR_REQ                           0x04
41#define SDP_SERVICE_ATTR_RSP                           0x05
42#define SDP_SERVICE_SEARCH_ATTR_REQ                    0x06
43#define SDP_SERVICE_SEARCH_ATTR_RSP                    0x07
44
45/* Bluetooth assigned UUIDs for protocols */
46#define SDP_UUID_SDP                                   0x0001
47#define SDP_UUID_UDP                                   0x0002
48#define SDP_UUID_RFCOMM                                0x0003
49#define SDP_UUID_TCP                                   0x0004
50#define SDP_UUID_TCS_BIN                               0x0005
51#define SDP_UUID_TCS_AT                                0x0006
52#define SDP_UUID_OBEX                                  0x0008
53#define SDP_UUID_IP                                    0x0009
54#define SDP_UUID_FTP                                   0x000A
55#define SDP_UUID_HTTP                                  0x000C
56#define SDP_UUID_WSP                                   0x000E
57#define SDP_UUID_BNEP                                  0x000F /* PAN */
58#define SDP_UUID_HIDP                                  0x0011 /* HID */
59#define SDP_UUID_CMTP                                  0x001B /* CIP */
60#define SDP_UUID_L2CAP                                 0x0100
61
62/* Bluetooth assigned UUIDs for Service Classes */
63#define SDP_UUID_SERVICE_DISCOVERY_SERVER              0x1000
64#define SDP_UUID_BROWSE_GROUP_DESCRIPTOR               0x1001
65#define SDP_UUID_PUBLIC_BROWSE_GROUP                   0x1002
66#define SDP_UUID_SERIAL_PORT                           0x1101
67#define SDP_UUID_LAN_ACCESS_PPP                        0x1102
68#define SDP_UUID_DIALUP_NETWORKING                     0x1103
69#define SDP_UUID_IR_MC_SYNC                            0x1104
70#define SDP_UUID_OBEX_OBJECT_PUSH                      0x1105
71#define SDP_UUID_OBEX_FILE_TRANSFER                    0x1106
72#define SDP_UUID_IR_MC_SYNC_COMMAND                    0x1107
73#define SDP_UUID_HEADSET                               0x1108
74#define SDP_UUID_CORDLESS_TELEPHONY                    0x1109
75#define SDP_UUID_INTERCOM                              0x1110
76#define SDP_UUID_FAX                                   0x1111
77#define SDP_UUID_HEADSET_AUDIO_GATEWAY                 0x1112
78#define SDP_UUID_PANU                                  0x1115 /* PAN */
79#define SDP_UUID_NAP                                   0x1116 /* PAN */
80#define SDP_UUID_GN                                    0x1117 /* PAN */
81#define SDP_UUID_IMAGING                               0x111a /* BIP */
82#define SDP_UUID_IMAGING_RESPONDER                     0x111b /* BIP */
83#define SDP_UUID_IMAGING_AUTOMATIC_ARCHIVE             0x111c /* BIP */
84#define SDP_UUID_IMAGING_REFERENCED_OBJECTS            0x111d /* BIP */
85#define SDP_UUID_HUMAN_INTERFACE_DEVICE                0x1124 /* HID */
86#define SDP_UUID_COMMON_ISDN_ACCESS                    0x1128 /* CIP */
87#define SDP_UUID_PNP_INFORMATION                       0x1200
88#define SDP_UUID_GENERIC_NETWORKING                    0x1201
89#define SDP_UUID_GENERIC_FILE_TRANSFER                 0x1202
90#define SDP_UUID_GENERIC_AUDIO                         0x1203
91#define SDP_UUID_GENERIC_TELEPHONY                     0x1204
92
93/* Bluetooth assigned numbers for Attribute IDs */
94#define SDP_ATTR_ID_SERVICE_RECORD_HANDLE              0x0000
95#define SDP_ATTR_ID_SERVICE_CLASS_ID_LIST              0x0001
96#define SDP_ATTR_ID_SERVICE_RECORD_STATE               0x0002
97#define SDP_ATTR_ID_SERVICE_SERVICE_ID                 0x0003
98#define SDP_ATTR_ID_PROTOCOL_DESCRIPTOR_LIST           0x0004
99#define SDP_ATTR_ID_BROWSE_GROUP_LIST                  0x0005
100#define SDP_ATTR_ID_LANGUAGE_BASE_ATTRIBUTE_ID_LIST    0x0006
101#define SDP_ATTR_ID_SERVICE_INFO_TIME_TO_LIVE          0x0007
102#define SDP_ATTR_ID_SERVICE_AVAILABILITY               0x0008
103#define SDP_ATTR_ID_BLUETOOTH_PROFILE_DESCRIPTOR_LIST  0x0009
104#define SDP_ATTR_ID_DOCUMENTATION_URL                  0x000A
105#define SDP_ATTR_ID_CLIENT_EXECUTABLE_URL              0x000B
106#define SDP_ATTR_ID_ICON_10                            0x000C
107#define SDP_ATTR_ID_ICON_URL                           0x000D
108#define SDP_ATTR_ID_SERVICE_NAME                       0x0100
109#define SDP_ATTR_ID_SERVICE_DESCRIPTION                0x0101
110#define SDP_ATTR_ID_PROVIDER_NAME                      0x0102
111#define SDP_ATTR_ID_VERSION_NUMBER_LIST                0x0200
112#define SDP_ATTR_ID_GROUP_ID                           0x0200
113#define SDP_ATTR_ID_SERVICE_DATABASE_STATE             0x0201
114#define SDP_ATTR_ID_SERVICE_VERSION                    0x0300
115
116#define SDP_ATTR_ID_EXTERNAL_NETWORK                   0x0301 /* Cordless Telephony */
117#define SDP_ATTR_ID_SUPPORTED_DATA_STORES_LIST         0x0301 /* Synchronization */
118#define SDP_ATTR_ID_REMOTE_AUDIO_VOLUME_CONTROL        0x0302 /* GAP */
119#define SDP_ATTR_ID_SUPPORTED_FORMATS_LIST             0x0303 /* OBEX Object Push */
120#define SDP_ATTR_ID_FAX_CLASS_1_SUPPORT                0x0302 /* Fax */
121#define SDP_ATTR_ID_FAX_CLASS_2_0_SUPPORT              0x0303
122#define SDP_ATTR_ID_FAX_CLASS_2_SUPPORT                0x0304
123#define SDP_ATTR_ID_AUDIO_FEEDBACK_SUPPORT             0x0305
124#define SDP_ATTR_ID_SECURITY_DESCRIPTION               0x030a /* PAN */
125#define SDP_ATTR_ID_NET_ACCESS_TYPE                    0x030b /* PAN */
126#define SDP_ATTR_ID_MAX_NET_ACCESS_RATE                0x030c /* PAN */
127#define SDP_ATTR_ID_IPV4_SUBNET                        0x030d /* PAN */
128#define SDP_ATTR_ID_IPV6_SUBNET                        0x030e /* PAN */
129
130/* Data element type descriptor */
131#define SDP_DE_NULL   0
132#define SDP_DE_UINT   1
133#define SDP_DE_INT    2
134#define SDP_DE_UUID   3
135#define SDP_DE_STRING 4
136#define SDP_DE_BOOL   5
137#define SDP_DE_SEQ    6
138#define SDP_DE_ALT    7
139#define SDP_DE_URL    8
140
141/* SDP structures */
142
143typedef struct {
144	uint8_t  pid;
145	uint16_t tid;
146	uint16_t len;
147} __attribute__ ((packed)) sdp_pdu_hdr;
148#define SDP_PDU_HDR_SIZE 5
149
150/* Data element size index lookup table */
151typedef struct {
152	int addl_bits;
153	int num_bytes;
154} sdp_siz_idx_lookup_table_t;
155extern sdp_siz_idx_lookup_table_t sdp_siz_idx_lookup_table[];
156
157/* UUID name lookup table */
158typedef struct {
159	int   uuid;
160	char* name;
161} sdp_uuid_nam_lookup_table_t;
162extern sdp_uuid_nam_lookup_table_t sdp_uuid_nam_lookup_table[];
163#define SDP_UUID_NAM_LOOKUP_TABLE_SIZE \
164	(sizeof(sdp_uuid_nam_lookup_table)/sizeof(sdp_uuid_nam_lookup_table_t))
165
166/* AttrID name lookup table */
167typedef struct {
168	int   attr_id;
169	char* name;
170} sdp_attr_id_nam_lookup_table_t;
171extern sdp_attr_id_nam_lookup_table_t sdp_attr_id_nam_lookup_table[];
172#define SDP_ATTR_ID_NAM_LOOKUP_TABLE_SIZE \
173	(sizeof(sdp_attr_id_nam_lookup_table)/sizeof(sdp_attr_id_nam_lookup_table_t))
174
175#endif /* __SDP_H */
176