xref: /netbsd-src/lib/libbluetooth/sdp.h (revision 388550b026d49b7f7b7480b1113bf82bb8d6a480)
1*388550b0Srillig /*	$NetBSD: sdp.h,v 1.3 2022/04/19 20:32:14 rillig Exp $	*/
2dfbf818aSplunky 
3dfbf818aSplunky /*-
4dfbf818aSplunky  * Copyright (c) 2006 Itronix Inc.
5dfbf818aSplunky  * All rights reserved.
6dfbf818aSplunky  *
7dfbf818aSplunky  * Written by Iain Hibbert for Itronix Inc.
8dfbf818aSplunky  *
9dfbf818aSplunky  * Redistribution and use in source and binary forms, with or without
10dfbf818aSplunky  * modification, are permitted provided that the following conditions
11dfbf818aSplunky  * are met:
12dfbf818aSplunky  * 1. Redistributions of source code must retain the above copyright
13dfbf818aSplunky  *    notice, this list of conditions and the following disclaimer.
14dfbf818aSplunky  * 2. Redistributions in binary form must reproduce the above copyright
15dfbf818aSplunky  *    notice, this list of conditions and the following disclaimer in the
16dfbf818aSplunky  *    documentation and/or other materials provided with the distribution.
17dfbf818aSplunky  * 3. The name of Itronix Inc. may not be used to endorse
18dfbf818aSplunky  *    or promote products derived from this software without specific
19dfbf818aSplunky  *    prior written permission.
20dfbf818aSplunky  *
21dfbf818aSplunky  * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
22dfbf818aSplunky  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23dfbf818aSplunky  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24dfbf818aSplunky  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
25dfbf818aSplunky  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26dfbf818aSplunky  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27dfbf818aSplunky  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28dfbf818aSplunky  * ON ANY THEORY OF LIABILITY, WHETHER IN
29dfbf818aSplunky  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30dfbf818aSplunky  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31dfbf818aSplunky  * POSSIBILITY OF SUCH DAMAGE.
32dfbf818aSplunky  */
33dfbf818aSplunky /*
34dfbf818aSplunky  * Copyright (c) 2001-2003, 2008 Maksim Yevmenkin <m_evmenkin@yahoo.com>
35dfbf818aSplunky  * All rights reserved.
36dfbf818aSplunky  *
37dfbf818aSplunky  * Redistribution and use in source and binary forms, with or without
38dfbf818aSplunky  * modification, are permitted provided that the following conditions
39dfbf818aSplunky  * are met:
40dfbf818aSplunky  * 1. Redistributions of source code must retain the above copyright
41dfbf818aSplunky  *    notice, this list of conditions and the following disclaimer.
42dfbf818aSplunky  * 2. Redistributions in binary form must reproduce the above copyright
43dfbf818aSplunky  *    notice, this list of conditions and the following disclaimer in the
44dfbf818aSplunky  *    documentation and/or other materials provided with the distribution.
45dfbf818aSplunky  *
46dfbf818aSplunky  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
47dfbf818aSplunky  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
48dfbf818aSplunky  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
49dfbf818aSplunky  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
50dfbf818aSplunky  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
51dfbf818aSplunky  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
52dfbf818aSplunky  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
53dfbf818aSplunky  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
54dfbf818aSplunky  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
55dfbf818aSplunky  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56dfbf818aSplunky  * SUCH DAMAGE.
57dfbf818aSplunky  *
58dfbf818aSplunky  * $FreeBSD: src/lib/libsdp/sdp.h,v 1.5 2005/05/27 19:11:33 emax Exp $
59dfbf818aSplunky  */
60dfbf818aSplunky 
61dfbf818aSplunky #ifndef _SDP_H_
62dfbf818aSplunky #define _SDP_H_
63dfbf818aSplunky 
64dfbf818aSplunky #include <stdbool.h>
65dfbf818aSplunky #include <uuid.h>
66dfbf818aSplunky 
67dfbf818aSplunky #include <bluetooth.h>
68dfbf818aSplunky 
69dfbf818aSplunky /*
70dfbf818aSplunky  * SDP Data Element types
71dfbf818aSplunky  */
72dfbf818aSplunky 
73dfbf818aSplunky #define SDP_DATA_TYPE(b)	((b) & 0xf8)
74dfbf818aSplunky #define SDP_DATA_SIZE(b)	((b) & 0x07)
75dfbf818aSplunky 
76dfbf818aSplunky /* data size descriptors */
77dfbf818aSplunky #define SDP_DATA_8		0x00
78dfbf818aSplunky #define SDP_DATA_16		0x01
79dfbf818aSplunky #define SDP_DATA_32		0x02
80dfbf818aSplunky #define SDP_DATA_64		0x03
81dfbf818aSplunky #define SDP_DATA_128		0x04
82dfbf818aSplunky #define SDP_DATA_EXT8		0x05
83dfbf818aSplunky #define SDP_DATA_EXT16		0x06
84dfbf818aSplunky #define SDP_DATA_EXT32		0x07
85dfbf818aSplunky 
86dfbf818aSplunky /* data type descriptors */
87dfbf818aSplunky #define SDP_DATA_NIL		0x00
88dfbf818aSplunky #define SDP_DATA_UINT		0x08
89dfbf818aSplunky #define SDP_DATA_INT		0x10
90dfbf818aSplunky #define SDP_DATA_UUID		0x18
91dfbf818aSplunky #define SDP_DATA_STR		0x20
92dfbf818aSplunky #define SDP_DATA_BOOL		0x28
93dfbf818aSplunky #define SDP_DATA_SEQ		0x30
94dfbf818aSplunky #define SDP_DATA_ALT		0x38
95dfbf818aSplunky #define SDP_DATA_URL		0x40
96dfbf818aSplunky 
97dfbf818aSplunky /* Unsigned integer */
98dfbf818aSplunky #define SDP_DATA_UINT8		(SDP_DATA_UINT | SDP_DATA_8)
99dfbf818aSplunky #define SDP_DATA_UINT16		(SDP_DATA_UINT | SDP_DATA_16)
100dfbf818aSplunky #define SDP_DATA_UINT32		(SDP_DATA_UINT | SDP_DATA_32)
101dfbf818aSplunky #define SDP_DATA_UINT64		(SDP_DATA_UINT | SDP_DATA_64)
102dfbf818aSplunky #define SDP_DATA_UINT128	(SDP_DATA_UINT | SDP_DATA_128)
103dfbf818aSplunky 
104dfbf818aSplunky /* Signed two's-complement integer */
105dfbf818aSplunky #define SDP_DATA_INT8		(SDP_DATA_INT | SDP_DATA_8)
106dfbf818aSplunky #define SDP_DATA_INT16		(SDP_DATA_INT | SDP_DATA_16)
107dfbf818aSplunky #define SDP_DATA_INT32		(SDP_DATA_INT | SDP_DATA_32)
108dfbf818aSplunky #define SDP_DATA_INT64		(SDP_DATA_INT | SDP_DATA_64)
109dfbf818aSplunky #define SDP_DATA_INT128		(SDP_DATA_INT | SDP_DATA_128)
110dfbf818aSplunky 
111dfbf818aSplunky /* UUID, a universally unique identifier */
112dfbf818aSplunky #define SDP_DATA_UUID16		(SDP_DATA_UUID | SDP_DATA_16)
113dfbf818aSplunky #define SDP_DATA_UUID32		(SDP_DATA_UUID | SDP_DATA_32)
114dfbf818aSplunky #define SDP_DATA_UUID128	(SDP_DATA_UUID | SDP_DATA_128)
115dfbf818aSplunky 
116dfbf818aSplunky /* Text string */
117dfbf818aSplunky #define SDP_DATA_STR8		(SDP_DATA_STR | SDP_DATA_EXT8)
118dfbf818aSplunky #define SDP_DATA_STR16		(SDP_DATA_STR | SDP_DATA_EXT16)
119dfbf818aSplunky #define SDP_DATA_STR32		(SDP_DATA_STR | SDP_DATA_EXT32)
120dfbf818aSplunky 
121dfbf818aSplunky /* Data element sequence */
122dfbf818aSplunky #define SDP_DATA_SEQ8		(SDP_DATA_SEQ | SDP_DATA_EXT8)
123dfbf818aSplunky #define SDP_DATA_SEQ16		(SDP_DATA_SEQ | SDP_DATA_EXT16)
124dfbf818aSplunky #define SDP_DATA_SEQ32		(SDP_DATA_SEQ | SDP_DATA_EXT32)
125dfbf818aSplunky 
126dfbf818aSplunky /* Data element alternative */
127dfbf818aSplunky #define SDP_DATA_ALT8		(SDP_DATA_ALT | SDP_DATA_EXT8)
128dfbf818aSplunky #define SDP_DATA_ALT16		(SDP_DATA_ALT | SDP_DATA_EXT16)
129dfbf818aSplunky #define SDP_DATA_ALT32		(SDP_DATA_ALT | SDP_DATA_EXT32)
130dfbf818aSplunky 
131dfbf818aSplunky /* URL, a uniform resource locator */
132dfbf818aSplunky #define SDP_DATA_URL8		(SDP_DATA_URL | SDP_DATA_EXT8)
133dfbf818aSplunky #define SDP_DATA_URL16		(SDP_DATA_URL | SDP_DATA_EXT16)
134dfbf818aSplunky #define SDP_DATA_URL32		(SDP_DATA_URL | SDP_DATA_EXT32)
135dfbf818aSplunky 
136dfbf818aSplunky /*
137dfbf818aSplunky  * Protocol UUIDs (short alias version)
138dfbf818aSplunky  *
139dfbf818aSplunky  * BLUETOOTH BASE UUID 00000000-0000-1000-8000-00805F9B34FB
140dfbf818aSplunky  */
141dfbf818aSplunky #define SDP_UUID_PROTOCOL_SDP				0x0001
142dfbf818aSplunky #define SDP_UUID_PROTOCOL_UDP				0x0002
143dfbf818aSplunky #define SDP_UUID_PROTOCOL_RFCOMM			0x0003
144dfbf818aSplunky #define SDP_UUID_PROTOCOL_TCP				0x0004
145dfbf818aSplunky #define SDP_UUID_PROTOCOL_TCS_BIN			0x0005
146dfbf818aSplunky #define SDP_UUID_PROTOCOL_TCS_AT			0x0006
147dfbf818aSplunky #define SDP_UUID_PROTOCOL_OBEX				0x0008
148dfbf818aSplunky #define SDP_UUID_PROTOCOL_IP				0x0009
149dfbf818aSplunky #define SDP_UUID_PROTOCOL_FTP				0x000A
150dfbf818aSplunky #define SDP_UUID_PROTOCOL_HTTP				0x000C
151dfbf818aSplunky #define SDP_UUID_PROTOCOL_WSP				0x000E
152dfbf818aSplunky #define SDP_UUID_PROTOCOL_BNEP				0x000F
153dfbf818aSplunky #define SDP_UUID_PROTOCOL_UPNP				0x0010
154dfbf818aSplunky #define SDP_UUID_PROTOCOL_HIDP				0x0011
155dfbf818aSplunky #define SDP_UUID_PROTOCOL_HARDCOPY_CONTROL_CHANNEL	0x0012
156dfbf818aSplunky #define SDP_UUID_PROTOCOL_HARDCOPY_DATA_CHANNEL		0x0014
157dfbf818aSplunky #define SDP_UUID_PROTOCOL_HARDCOPY_NOTIFICATION		0x0016
158dfbf818aSplunky #define SDP_UUID_PROTOCOL_AVCTP				0x0017
159dfbf818aSplunky #define SDP_UUID_PROTOCOL_AVDTP				0x0019
160dfbf818aSplunky #define SDP_UUID_PROTOCOL_CMPT				0x001B
161dfbf818aSplunky #define SDP_UUID_PROTOCOL_UDI_C_PLANE			0x001D
162ca5b4d6eSplunky #define SDP_UUID_PROTOCOL_MCAP_CONTROL_CHANNEL		0x001E
163ca5b4d6eSplunky #define SDP_UUID_PROTOCOL_MCAP_DATA_CHANNEL		0x001F
164dfbf818aSplunky #define SDP_UUID_PROTOCOL_L2CAP				0x0100
165dfbf818aSplunky 
166dfbf818aSplunky /*
167dfbf818aSplunky  * Service Class IDs
168dfbf818aSplunky  */
169dfbf818aSplunky #define SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER	0x1000
170dfbf818aSplunky #define SDP_SERVICE_CLASS_BROWSE_GROUP_DESCRIPTOR	0x1001
171dfbf818aSplunky #define SDP_SERVICE_CLASS_PUBLIC_BROWSE_GROUP		0x1002
172dfbf818aSplunky #define SDP_SERVICE_CLASS_SERIAL_PORT			0x1101
173dfbf818aSplunky #define SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP		0x1102
174dfbf818aSplunky #define SDP_SERVICE_CLASS_DIALUP_NETWORKING		0x1103
175dfbf818aSplunky #define SDP_SERVICE_CLASS_IR_MC_SYNC			0x1104
176dfbf818aSplunky #define SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH		0x1105
177dfbf818aSplunky #define SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER		0x1106
178dfbf818aSplunky #define SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND		0x1107
179dfbf818aSplunky #define SDP_SERVICE_CLASS_HEADSET			0x1108
180dfbf818aSplunky #define SDP_SERVICE_CLASS_CORDLESS_TELEPHONY		0x1109
181dfbf818aSplunky #define SDP_SERVICE_CLASS_AUDIO_SOURCE			0x110A
182dfbf818aSplunky #define SDP_SERVICE_CLASS_AUDIO_SINK			0x110B
183dfbf818aSplunky #define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_TARGET	0x110C
184dfbf818aSplunky #define SDP_SERVICE_CLASS_ADVANCED_AUDIO_DISTRIBUTION	0x110D
185dfbf818aSplunky #define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL		0x110E
186dfbf818aSplunky #define SDP_SERVICE_CLASS_VIDEO_CONFERENCING		0x110F
187dfbf818aSplunky #define SDP_SERVICE_CLASS_INTERCOM			0x1110
188dfbf818aSplunky #define SDP_SERVICE_CLASS_FAX				0x1111
189dfbf818aSplunky #define SDP_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY		0x1112
190dfbf818aSplunky #define SDP_SERVICE_CLASS_WAP				0x1113
191dfbf818aSplunky #define SDP_SERVICE_CLASS_WAP_CLIENT			0x1114
192dfbf818aSplunky #define SDP_SERVICE_CLASS_PANU				0x1115
193dfbf818aSplunky #define SDP_SERVICE_CLASS_NAP				0x1116
194dfbf818aSplunky #define SDP_SERVICE_CLASS_GN				0x1117
195dfbf818aSplunky #define SDP_SERVICE_CLASS_DIRECT_PRINTING		0x1118
196dfbf818aSplunky #define SDP_SERVICE_CLASS_REFERENCE_PRINTING		0x1119
197dfbf818aSplunky #define SDP_SERVICE_CLASS_IMAGING			0x111A
198dfbf818aSplunky #define SDP_SERVICE_CLASS_IMAGING_RESPONDER		0x111B
199dfbf818aSplunky #define SDP_SERVICE_CLASS_IMAGING_AUTOMATIC_ARCHIVE	0x111C
200dfbf818aSplunky #define SDP_SERVICE_CLASS_IMAGING_REFERENCED_OBJECTS	0x111D
201dfbf818aSplunky #define SDP_SERVICE_CLASS_HANDSFREE			0x111E
202dfbf818aSplunky #define SDP_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY	0x111F
203dfbf818aSplunky #define SDP_SERVICE_CLASS_DIRECT_PRINTING_REFERENCE_OBJECTS	0x1120
204dfbf818aSplunky #define SDP_SERVICE_CLASS_REFLECTED_UI			0x1121
205dfbf818aSplunky #define SDP_SERVICE_CLASS_BASIC_PRINTING		0x1122
206dfbf818aSplunky #define SDP_SERVICE_CLASS_PRINTING_STATUS		0x1123
207dfbf818aSplunky #define SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE	0x1124
208dfbf818aSplunky #define SDP_SERVICE_CLASS_HARDCOPY_CABLE_REPLACEMENT	0x1125
209dfbf818aSplunky #define SDP_SERVICE_CLASS_HCR_PRINT			0x1126
210dfbf818aSplunky #define SDP_SERVICE_CLASS_HCR_SCAN			0x1127
211dfbf818aSplunky #define SDP_SERVICE_CLASS_COMMON_ISDN_ACCESS		0x1128
212dfbf818aSplunky #define SDP_SERVICE_CLASS_VIDEO_CONFERENCING_GW		0x1129
213dfbf818aSplunky #define SDP_SERVICE_CLASS_UDI_MT			0x112A
214dfbf818aSplunky #define SDP_SERVICE_CLASS_UDI_TA			0x112B
215dfbf818aSplunky #define SDP_SERVICE_CLASS_AUDIO_VIDEO			0x112C
216dfbf818aSplunky #define SDP_SERVICE_CLASS_SIM_ACCESS			0x112D
217ca5b4d6eSplunky #define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS_PCE		0x112E
218ca5b4d6eSplunky #define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS_PSE		0x112F
219ca5b4d6eSplunky #define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS		0x1130
220ca5b4d6eSplunky #define SDP_SERVICE_CLASS_HEADSET_HS			0x1131
221ca5b4d6eSplunky #define SDP_SERVICE_CLASS_MESSAGE_ACCESS_SERVER		0x1132
222ca5b4d6eSplunky #define SDP_SERVICE_CLASS_MESSAGE_NOTIFICATION_SERVER	0x1133
223ca5b4d6eSplunky #define SDP_SERVICE_CLASS_MESSAGE_ACCESS_PROFILE	0x1134
224dfbf818aSplunky #define SDP_SERVICE_CLASS_PNP_INFORMATION		0x1200
225dfbf818aSplunky #define SDP_SERVICE_CLASS_GENERIC_NETWORKING		0x1201
226dfbf818aSplunky #define SDP_SERVICE_CLASS_GENERIC_FILE_TRANSFER		0x1202
227dfbf818aSplunky #define SDP_SERVICE_CLASS_GENERIC_AUDIO			0x1203
228dfbf818aSplunky #define SDP_SERVICE_CLASS_GENERIC_TELEPHONY		0x1204
229dfbf818aSplunky #define SDP_SERVICE_CLASS_UPNP				0x1205
230dfbf818aSplunky #define SDP_SERVICE_CLASS_UPNP_IP			0x1206
231dfbf818aSplunky #define SDP_SERVICE_CLASS_ESDP_UPNP_IP_PAN		0x1300
232dfbf818aSplunky #define SDP_SERVICE_CLASS_ESDP_UPNP_IP_LAP		0x1301
233dfbf818aSplunky #define SDP_SERVICE_CLASS_ESDP_UPNP_L2CAP		0x1302
234ca5b4d6eSplunky #define SDP_SERVICE_CLASS_VIDEO_SOURCE			0x1303
235ca5b4d6eSplunky #define SDP_SERVICE_CLASS_VIDEO_SINK			0x1304
236ca5b4d6eSplunky #define SDP_SERVICE_CLASS_VIDEO_DISTRIBUTION		0x1305
237ca5b4d6eSplunky #define SDP_SERVICE_CLASS_HDP				0x1400
238ca5b4d6eSplunky #define SDP_SERVICE_CLASS_HDP_SOURCE			0x1401
239ca5b4d6eSplunky #define SDP_SERVICE_CLASS_HDP_SINK			0x1402
240dfbf818aSplunky 
241dfbf818aSplunky /*
242dfbf818aSplunky  * Universal Attribute definitions valid in all service classes
243dfbf818aSplunky  */
244dfbf818aSplunky #define SDP_ATTR_SERVICE_RECORD_HANDLE			0x0000
245dfbf818aSplunky #define SDP_ATTR_SERVICE_CLASS_ID_LIST			0x0001
246dfbf818aSplunky #define SDP_ATTR_SERVICE_RECORD_STATE			0x0002
247dfbf818aSplunky #define SDP_ATTR_SERVICE_ID				0x0003
248dfbf818aSplunky #define SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST		0x0004
249dfbf818aSplunky #define SDP_ATTR_BROWSE_GROUP_LIST			0x0005
250dfbf818aSplunky #define SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST	0x0006
251dfbf818aSplunky #define SDP_ATTR_SERVICE_INFO_TIME_TO_LIVE		0x0007
252dfbf818aSplunky #define SDP_ATTR_SERVICE_AVAILABILITY			0x0008
253dfbf818aSplunky #define SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST	0x0009
254dfbf818aSplunky #define SDP_ATTR_DOCUMENTATION_URL			0x000A
255dfbf818aSplunky #define SDP_ATTR_CLIENT_EXECUTABLE_URL			0x000B
256dfbf818aSplunky #define SDP_ATTR_ICON_URL				0x000C
257dfbf818aSplunky #define SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS	0x000D
258dfbf818aSplunky /* 0x000E-0x01ff are reserved */
259dfbf818aSplunky 
260dfbf818aSplunky /*
261dfbf818aSplunky  * The offset must be added to the attribute ID base (contained in the
262dfbf818aSplunky  * LANGUAGE_BASE_ATTRIBUTE_ID_LIST attribute value) in order to compute
263dfbf818aSplunky  * the attribute ID for these attributes.
264dfbf818aSplunky  * The primary language base is always 0x0100.
265dfbf818aSplunky  */
266dfbf818aSplunky #define SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID		0x0100
267dfbf818aSplunky #define SDP_ATTR_SERVICE_NAME_OFFSET			0x0000
268dfbf818aSplunky #define SDP_ATTR_SERVICE_DESCRIPTION_OFFSET		0x0001
269dfbf818aSplunky #define SDP_ATTR_PROVIDER_NAME_OFFSET			0x0002
270dfbf818aSplunky 
271dfbf818aSplunky /* ServiceDiscoveryServer profile attribute definitions */
272dfbf818aSplunky #define SDP_ATTR_VERSION_NUMBER_LIST			0x0200
273dfbf818aSplunky #define SDP_ATTR_SERVICE_DATABASE_STATE			0x0201
274dfbf818aSplunky 
275dfbf818aSplunky /* BrowseGroupDescriptor profile attribute definitions */
276dfbf818aSplunky #define SDP_ATTR_GROUP_ID				0x0200
277dfbf818aSplunky 
278dfbf818aSplunky /* Other profile attribute definitions */
279dfbf818aSplunky #define SDP_ATTR_IP_SUBNET				0x0200
280ca5b4d6eSplunky #define SDP_ATTR_SUPPORT_FEATURES_LIST			0x0200
281dfbf818aSplunky #define SDP_ATTR_SERVICE_VERSION			0x0300
282ca5b4d6eSplunky #define SDP_ATTR_DATA_EXCHANGE_SPECIFICATION		0x0301
283dfbf818aSplunky #define SDP_ATTR_EXTERNAL_NETWORK			0x0301
284dfbf818aSplunky #define SDP_ATTR_NETWORK				0x0301
285dfbf818aSplunky #define SDP_ATTR_SUPPORTED_DATA_STORES_LIST		0x0301
286dfbf818aSplunky #define SDP_ATTR_FAX_CLASS1_SUPPORT			0x0302
287dfbf818aSplunky #define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL		0x0302
288ca5b4d6eSplunky #define SDP_ATTR_MCAP_SUPPORTED_PROCEDURES		0x0302
289dfbf818aSplunky #define SDP_ATTR_FAX_CLASS20_SUPPORT			0x0303
290dfbf818aSplunky #define SDP_ATTR_SUPPORTED_FORMATS_LIST			0x0303
291dfbf818aSplunky #define SDP_ATTR_FAX_CLASS2_SUPPORT			0x0304
292dfbf818aSplunky #define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT			0x0305
293dfbf818aSplunky #define SDP_ATTR_NETWORK_ADDRESS			0x0306
294dfbf818aSplunky #define SDP_ATTR_WAP_GATEWAY				0x0307
295dfbf818aSplunky #define SDP_ATTR_HOME_PAGE_URL				0x0308
296dfbf818aSplunky #define SDP_ATTR_WAP_STACK_TYPE				0x0309
297dfbf818aSplunky #define SDP_ATTR_SECURITY_DESCRIPTION			0x030A
298dfbf818aSplunky #define SDP_ATTR_NET_ACCESS_TYPE			0x030B
299dfbf818aSplunky #define SDP_ATTR_MAX_NET_ACCESS_RATE			0x030C
300dfbf818aSplunky #define SDP_ATTR_IPV4_SUBNET				0x030D
301dfbf818aSplunky #define SDP_ATTR_IPV6_SUBNET				0x030E
302dfbf818aSplunky #define SDP_ATTR_SUPPORTED_CAPABALITIES			0x0310
303dfbf818aSplunky #define SDP_ATTR_SUPPORTED_FEATURES			0x0311
304dfbf818aSplunky #define SDP_ATTR_SUPPORTED_FUNCTIONS			0x0312
305dfbf818aSplunky #define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY		0x0313
306ca5b4d6eSplunky #define SDP_ATTR_SUPPORTED_REPOSITORIES			0x0314
307ca5b4d6eSplunky #define SDP_ATTR_MAS_INSTANCE_ID			0x0315
308ca5b4d6eSplunky #define SDP_ATTR_SUPPORTED_MESSAGE_TYPES		0x0316
309dfbf818aSplunky 
310dfbf818aSplunky /*
311dfbf818aSplunky  * Protocol Data Unit (PDU) header format
312dfbf818aSplunky  */
313dfbf818aSplunky 
314dfbf818aSplunky typedef struct {
315dfbf818aSplunky 	uint8_t		pid;	/* PDU ID - SDP_PDU_xxx */
316dfbf818aSplunky 	uint16_t	tid;	/* transaction ID */
317dfbf818aSplunky 	uint16_t	len;	/* parameters length (in bytes) */
318dfbf818aSplunky } __packed sdp_pdu_t;
319dfbf818aSplunky 
320dfbf818aSplunky /* PDU IDs */
321dfbf818aSplunky #define SDP_PDU_ERROR_RESPONSE				0x01
322dfbf818aSplunky #define SDP_PDU_SERVICE_SEARCH_REQUEST			0x02
323dfbf818aSplunky #define SDP_PDU_SERVICE_SEARCH_RESPONSE			0x03
324dfbf818aSplunky #define SDP_PDU_SERVICE_ATTRIBUTE_REQUEST		0x04
325dfbf818aSplunky #define SDP_PDU_SERVICE_ATTRIBUTE_RESPONSE		0x05
326dfbf818aSplunky #define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST	0x06
327dfbf818aSplunky #define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_RESPONSE	0x07
328dfbf818aSplunky 
329dfbf818aSplunky /* Error codes for SDP_PDU_ERROR_RESPONSE */
330dfbf818aSplunky #define SDP_ERROR_CODE_INVALID_SDP_VERSION		0x0001
331dfbf818aSplunky #define SDP_ERROR_CODE_INVALID_SERVICE_RECORD_HANDLE	0x0002
332dfbf818aSplunky #define SDP_ERROR_CODE_INVALID_REQUEST_SYNTAX		0x0003
333dfbf818aSplunky #define SDP_ERROR_CODE_INVALID_PDU_SIZE			0x0004
334dfbf818aSplunky #define SDP_ERROR_CODE_INVALID_CONTINUATION_STATE	0x0005
335dfbf818aSplunky #define SDP_ERROR_CODE_INSUFFICIENT_RESOURCES		0x0006
336dfbf818aSplunky 
337dfbf818aSplunky 
338dfbf818aSplunky /*****************************************************************************
339dfbf818aSplunky  *	sdpd(8) interface
340dfbf818aSplunky  */
341dfbf818aSplunky 
342dfbf818aSplunky #define SDP_LOCAL_PATH	"/var/run/sdp"
343dfbf818aSplunky #define SDP_LOCAL_MTU	L2CAP_MTU_DEFAULT
344dfbf818aSplunky 
345dfbf818aSplunky /*
346dfbf818aSplunky  * These are NOT defined in spec and the requests are only accepted
347dfbf818aSplunky  * by sdpd(8) on the control socket. The response will be an Error
348dfbf818aSplunky  * Response with an ErrorCode of 0x0000 indicating success.
349dfbf818aSplunky  */
350dfbf818aSplunky #define SDP_PDU_RECORD_INSERT_REQUEST			0x84
351dfbf818aSplunky #define SDP_PDU_RECORD_UPDATE_REQUEST			0x86
352dfbf818aSplunky #define SDP_PDU_RECORD_REMOVE_REQUEST			0x82
353dfbf818aSplunky 
354dfbf818aSplunky 
355dfbf818aSplunky /******************************************************************************
356dfbf818aSplunky  *	Service Discovery API in libbluetooth(3)
357dfbf818aSplunky  */
358dfbf818aSplunky 
359dfbf818aSplunky typedef struct {
360dfbf818aSplunky 	uint8_t *next;
361dfbf818aSplunky 	uint8_t *end;
362dfbf818aSplunky } sdp_data_t;
363dfbf818aSplunky 
364dfbf818aSplunky typedef struct sdp_session *sdp_session_t;
365dfbf818aSplunky 
366dfbf818aSplunky /* sdp_uuid.c */
367dfbf818aSplunky extern const uuid_t BLUETOOTH_BASE_UUID;
368dfbf818aSplunky 
369dfbf818aSplunky #ifndef SDP_COMPAT
370dfbf818aSplunky /* sdp_session.c */
371dfbf818aSplunky sdp_session_t sdp_open(const bdaddr_t *, const bdaddr_t *) __RENAME(_sdp_open);
372dfbf818aSplunky sdp_session_t sdp_open_local(const char *) __RENAME(_sdp_open_local);
373dfbf818aSplunky void sdp_close(sdp_session_t) __RENAME(_sdp_close);
374dfbf818aSplunky 
375dfbf818aSplunky /* sdp_record.c */
376dfbf818aSplunky bool sdp_record_insert(sdp_session_t, bdaddr_t *, uint32_t *, const sdp_data_t *);
377dfbf818aSplunky bool sdp_record_update(sdp_session_t, uint32_t, const sdp_data_t *);
378dfbf818aSplunky bool sdp_record_remove(sdp_session_t, uint32_t);
379dfbf818aSplunky 
380dfbf818aSplunky /* sdp_service.c */
381dfbf818aSplunky bool sdp_service_search(sdp_session_t, const sdp_data_t *, uint32_t *, int *);
382dfbf818aSplunky bool sdp_service_attribute(sdp_session_t, uint32_t, const sdp_data_t *, sdp_data_t *);
383dfbf818aSplunky bool sdp_service_search_attribute(sdp_session_t, const sdp_data_t *, const sdp_data_t *, sdp_data_t *);
384dfbf818aSplunky #endif
385dfbf818aSplunky 
386dfbf818aSplunky /* sdp_match.c */
387dfbf818aSplunky bool sdp_match_uuid16(sdp_data_t *, uint16_t);
388dfbf818aSplunky 
389dfbf818aSplunky /* sdp_get.c */
390dfbf818aSplunky bool sdp_get_data(sdp_data_t *, sdp_data_t *);
391dfbf818aSplunky bool sdp_get_attr(sdp_data_t *, uint16_t *, sdp_data_t *);
392dfbf818aSplunky bool sdp_get_uuid(sdp_data_t *, uuid_t *);
393dfbf818aSplunky bool sdp_get_bool(sdp_data_t *, bool *);
394dfbf818aSplunky bool sdp_get_seq(sdp_data_t *, sdp_data_t *);
395dfbf818aSplunky bool sdp_get_alt(sdp_data_t *, sdp_data_t *);
396dfbf818aSplunky bool sdp_get_uint(sdp_data_t *, uintmax_t *);
397dfbf818aSplunky bool sdp_get_int(sdp_data_t *, intmax_t *);
398dfbf818aSplunky bool sdp_get_str(sdp_data_t *, char **, size_t *);
399dfbf818aSplunky bool sdp_get_url(sdp_data_t *, char **, size_t *);
400dfbf818aSplunky 
401dfbf818aSplunky /* sdp_put.c */
402dfbf818aSplunky bool sdp_put_data(sdp_data_t *, sdp_data_t *);
403dfbf818aSplunky bool sdp_put_attr(sdp_data_t *, uint16_t, sdp_data_t *);
404dfbf818aSplunky bool sdp_put_uuid(sdp_data_t *, const uuid_t *);
405dfbf818aSplunky bool sdp_put_uuid16(sdp_data_t *, uint16_t);
406dfbf818aSplunky bool sdp_put_uuid32(sdp_data_t *, uint32_t);
407dfbf818aSplunky bool sdp_put_uuid128(sdp_data_t *, const uuid_t *);
408dfbf818aSplunky bool sdp_put_bool(sdp_data_t *, bool);
409dfbf818aSplunky bool sdp_put_uint(sdp_data_t *, uintmax_t);
410dfbf818aSplunky bool sdp_put_uint8(sdp_data_t *, uint8_t);
411dfbf818aSplunky bool sdp_put_uint16(sdp_data_t *, uint16_t);
412dfbf818aSplunky bool sdp_put_uint32(sdp_data_t *, uint32_t);
413dfbf818aSplunky bool sdp_put_uint64(sdp_data_t *, uint64_t);
414dfbf818aSplunky bool sdp_put_int(sdp_data_t *, intmax_t);
415dfbf818aSplunky bool sdp_put_int8(sdp_data_t *, int8_t);
416dfbf818aSplunky bool sdp_put_int16(sdp_data_t *, int16_t);
417dfbf818aSplunky bool sdp_put_int32(sdp_data_t *, int32_t);
418dfbf818aSplunky bool sdp_put_int64(sdp_data_t *, int64_t);
419dfbf818aSplunky bool sdp_put_seq(sdp_data_t *, ssize_t);
420dfbf818aSplunky bool sdp_put_alt(sdp_data_t *, ssize_t);
421dfbf818aSplunky bool sdp_put_str(sdp_data_t *, const char *, ssize_t);
422dfbf818aSplunky bool sdp_put_url(sdp_data_t *, const char *, ssize_t);
423dfbf818aSplunky 
424dfbf818aSplunky /* sdp_set.c */
425dfbf818aSplunky bool sdp_set_bool(const sdp_data_t *, bool);
426dfbf818aSplunky bool sdp_set_uint(const sdp_data_t *, uintmax_t);
427dfbf818aSplunky bool sdp_set_int(const sdp_data_t *, intmax_t);
428dfbf818aSplunky bool sdp_set_seq(const sdp_data_t *, ssize_t);
429dfbf818aSplunky bool sdp_set_alt(const sdp_data_t *, ssize_t);
430dfbf818aSplunky 
431dfbf818aSplunky /* sdp_data.c */
432dfbf818aSplunky ssize_t sdp_data_size(const sdp_data_t *);
433dfbf818aSplunky int sdp_data_type(const sdp_data_t *);
434dfbf818aSplunky bool sdp_data_valid(const sdp_data_t *);
435dfbf818aSplunky void sdp_data_print(const sdp_data_t *, int);
436dfbf818aSplunky 
437dfbf818aSplunky /******************************************************************************
438dfbf818aSplunky  *
439dfbf818aSplunky  *	Source level compatibility with old API
440dfbf818aSplunky  *
441dfbf818aSplunky  * enable with -DSDP_COMPAT but it will be removed eventually
442dfbf818aSplunky  *
443dfbf818aSplunky  ******************************************************************************/
444dfbf818aSplunky 
445dfbf818aSplunky #ifdef SDP_COMPAT
446dfbf818aSplunky #include <strings.h>
447dfbf818aSplunky 
448dfbf818aSplunky typedef sdp_pdu_t *sdp_pdu_p;
449dfbf818aSplunky 
450dfbf818aSplunky #define SDP_PDU_SERVICE_REGISTER_REQUEST		0x81
451dfbf818aSplunky #define SDP_PDU_SERVICE_UNREGISTER_REQUEST		0x82
452dfbf818aSplunky #define SDP_PDU_SERVICE_CHANGE_REQUEST			0x83
453dfbf818aSplunky 
454dfbf818aSplunky /*
455dfbf818aSplunky  * SDP int128/uint128 parameter
456dfbf818aSplunky  */
457dfbf818aSplunky 
458dfbf818aSplunky struct int128 {
459dfbf818aSplunky 	int8_t	b[16];
460dfbf818aSplunky };
461dfbf818aSplunky typedef struct int128	int128_t;
462dfbf818aSplunky typedef struct int128	uint128_t;
463dfbf818aSplunky 
464dfbf818aSplunky /*
465dfbf818aSplunky  * SDP attribute
466dfbf818aSplunky  */
467dfbf818aSplunky 
468dfbf818aSplunky struct sdp_attr {
469dfbf818aSplunky 	uint16_t	 flags;
470dfbf818aSplunky #define SDP_ATTR_OK		(0 << 0)
471dfbf818aSplunky #define SDP_ATTR_INVALID	(1 << 0)
472dfbf818aSplunky #define SDP_ATTR_TRUNCATED	(1 << 1)
473dfbf818aSplunky 	uint16_t	 attr;  /* SDP_ATTR_xxx */
474dfbf818aSplunky 	uint32_t	 vlen;	/* length of the value[] in bytes */
475dfbf818aSplunky 	uint8_t		*value;	/* base pointer */
476dfbf818aSplunky };
477dfbf818aSplunky typedef struct sdp_attr		sdp_attr_t;
478dfbf818aSplunky typedef struct sdp_attr *	sdp_attr_p;
479dfbf818aSplunky 
480dfbf818aSplunky #define SDP_ATTR_RANGE(lo, hi) \
481dfbf818aSplunky 	(uint32_t)(((uint16_t)(lo) << 16) | ((uint16_t)(hi)))
482dfbf818aSplunky 
483dfbf818aSplunky /* sdp_compat.c */
484dfbf818aSplunky void *sdp_open(bdaddr_t const *, bdaddr_t const *);
485dfbf818aSplunky void *sdp_open_local(char const *);
486dfbf818aSplunky int32_t sdp_close(void *);
487dfbf818aSplunky int32_t sdp_error(void *);
488dfbf818aSplunky int32_t sdp_search(void *, uint32_t, uint16_t const *, uint32_t, uint32_t const *, uint32_t, sdp_attr_t *);
489dfbf818aSplunky int32_t	sdp_register_service(void *, uint16_t, bdaddr_t *, uint8_t *, uint32_t, uint32_t *);
490dfbf818aSplunky int32_t	sdp_unregister_service(void *, uint32_t);
491dfbf818aSplunky int32_t	sdp_change_service(void *, uint32_t, uint8_t *, uint32_t);
492dfbf818aSplunky const char *sdp_attr2desc(uint16_t);
493dfbf818aSplunky const char *sdp_uuid2desc(uint16_t);
494dfbf818aSplunky void sdp_print(uint32_t, uint8_t *, uint8_t const *);
495dfbf818aSplunky 
496dfbf818aSplunky /* Inline versions of get/put byte/short/long. Pointer is advanced */
497dfbf818aSplunky #define SDP_GET8(b, cp)		do {			\
498dfbf818aSplunky 	(b) = *(const uint8_t *)(cp);			\
499dfbf818aSplunky 	(cp) += sizeof(uint8_t);			\
500*388550b0Srillig } while (0)
501dfbf818aSplunky 
502dfbf818aSplunky #define SDP_GET16(s, cp)	do {			\
503dfbf818aSplunky 	(s) = be16dec(cp);				\
504dfbf818aSplunky 	(cp) += sizeof(uint16_t);			\
505*388550b0Srillig } while (0)
506dfbf818aSplunky 
507dfbf818aSplunky #define SDP_GET32(l, cp)	do {			\
508dfbf818aSplunky 	(l) = be32dec(cp);				\
509dfbf818aSplunky 	(cp) += sizeof(uint32_t);			\
510*388550b0Srillig } while (0)
511dfbf818aSplunky 
512dfbf818aSplunky #define SDP_GET64(l, cp)	do {			\
513dfbf818aSplunky 	(l) = be64dec(cp);				\
514dfbf818aSplunky 	(cp) += sizeof(uint64_t);			\
515*388550b0Srillig } while (0)
516dfbf818aSplunky 
517dfbf818aSplunky #if BYTE_ORDER == LITTLE_ENDIAN
518dfbf818aSplunky #define SDP_GET128(l, cp)	do {			\
519dfbf818aSplunky 	register const uint8_t *t_cp = (const uint8_t *)(cp);	\
520dfbf818aSplunky 	(l)->b[15] = *t_cp++;				\
521dfbf818aSplunky 	(l)->b[14] = *t_cp++;				\
522dfbf818aSplunky 	(l)->b[13] = *t_cp++;				\
523dfbf818aSplunky 	(l)->b[12] = *t_cp++;				\
524dfbf818aSplunky 	(l)->b[11] = *t_cp++;				\
525dfbf818aSplunky 	(l)->b[10] = *t_cp++;				\
526dfbf818aSplunky 	(l)->b[9]  = *t_cp++;				\
527dfbf818aSplunky 	(l)->b[8]  = *t_cp++;				\
528dfbf818aSplunky 	(l)->b[7]  = *t_cp++;				\
529dfbf818aSplunky 	(l)->b[6]  = *t_cp++;				\
530dfbf818aSplunky 	(l)->b[5]  = *t_cp++;				\
531dfbf818aSplunky 	(l)->b[4]  = *t_cp++;				\
532dfbf818aSplunky 	(l)->b[3]  = *t_cp++;				\
533dfbf818aSplunky 	(l)->b[2]  = *t_cp++;				\
534dfbf818aSplunky 	(l)->b[1]  = *t_cp++;				\
535dfbf818aSplunky 	(l)->b[0]  = *t_cp++;				\
536dfbf818aSplunky 	(cp) += 16;					\
537*388550b0Srillig } while (0)
538dfbf818aSplunky 
539dfbf818aSplunky #define SDP_GET_UUID128(l, cp)	do {			\
540dfbf818aSplunky 	memcpy(&((l)->b), (cp), 16);			\
541dfbf818aSplunky 	(cp) += 16;					\
542*388550b0Srillig } while (0)
543dfbf818aSplunky #elif BYTE_ORDER == BIG_ENDIAN
544dfbf818aSplunky #define SDP_GET128(l, cp)	do {			\
545dfbf818aSplunky 	memcpy(&((l)->b), (cp), 16);			\
546dfbf818aSplunky 	(cp) += 16;					\
547*388550b0Srillig } while (0)
548dfbf818aSplunky 
549dfbf818aSplunky #define SDP_GET_UUID128(l, cp)	SDP_GET128(l, cp)
550dfbf818aSplunky #else
551dfbf818aSplunky #error	"Unsupported BYTE_ORDER"
552dfbf818aSplunky #endif /* BYTE_ORDER */
553dfbf818aSplunky 
554dfbf818aSplunky #define SDP_PUT8(b, cp)		do {			\
555dfbf818aSplunky 	*(uint8_t *)(cp) = (b);				\
556dfbf818aSplunky 	(cp) += sizeof(uint8_t);			\
557*388550b0Srillig } while (0)
558dfbf818aSplunky 
559dfbf818aSplunky #define SDP_PUT16(s, cp)	do {			\
560dfbf818aSplunky 	be16enc((cp), (s));				\
561dfbf818aSplunky 	(cp) += sizeof(uint16_t);			\
562*388550b0Srillig } while (0)
563dfbf818aSplunky 
564dfbf818aSplunky #define SDP_PUT32(s, cp)	do {			\
565dfbf818aSplunky 	be32enc((cp), (s));				\
566dfbf818aSplunky 	(cp) += sizeof(uint32_t);			\
567*388550b0Srillig } while (0)
568dfbf818aSplunky 
569dfbf818aSplunky #define SDP_PUT64(s, cp)	do {			\
570dfbf818aSplunky 	be64enc((cp), (s));				\
571dfbf818aSplunky 	(cp) += sizeof(uint64_t);			\
572*388550b0Srillig } while (0)
573dfbf818aSplunky 
574dfbf818aSplunky #if BYTE_ORDER == LITTLE_ENDIAN
575dfbf818aSplunky #define SDP_PUT128(l, cp)	do {			\
576dfbf818aSplunky 	register const uint8_t *t_cp = (const uint8_t *)(cp);	\
577dfbf818aSplunky 	*t_cp++ = (l)->b[15];				\
578dfbf818aSplunky 	*t_cp++ = (l)->b[14];				\
579dfbf818aSplunky 	*t_cp++ = (l)->b[13];				\
580dfbf818aSplunky 	*t_cp++ = (l)->b[12];				\
581dfbf818aSplunky 	*t_cp++ = (l)->b[11];				\
582dfbf818aSplunky 	*t_cp++ = (l)->b[10];				\
583dfbf818aSplunky 	*t_cp++ = (l)->b[9];				\
584dfbf818aSplunky 	*t_cp++ = (l)->b[8];				\
585dfbf818aSplunky 	*t_cp++ = (l)->b[7];				\
586dfbf818aSplunky 	*t_cp++ = (l)->b[6];				\
587dfbf818aSplunky 	*t_cp++ = (l)->b[5];				\
588dfbf818aSplunky 	*t_cp++ = (l)->b[4];				\
589dfbf818aSplunky 	*t_cp++ = (l)->b[3];				\
590dfbf818aSplunky 	*t_cp++ = (l)->b[2];				\
591dfbf818aSplunky 	*t_cp++ = (l)->b[1];				\
592dfbf818aSplunky 	*t_cp   = (l)->b[0];				\
593dfbf818aSplunky 	(cp) += 16;					\
594*388550b0Srillig } while (0)
595dfbf818aSplunky 
596dfbf818aSplunky #define SDP_PUT_UUID128(l, cp)	do {			\
597dfbf818aSplunky 	memcpy((cp), &((l)->b), 16);			\
598dfbf818aSplunky 	(cp) += 16;					\
599*388550b0Srillig } while (0)
600dfbf818aSplunky #elif BYTE_ORDER == BIG_ENDIAN
601dfbf818aSplunky #define SDP_PUT128(l, cp)	do {			\
602dfbf818aSplunky 	memcpy((cp), &((l)->b), 16);			\
603dfbf818aSplunky 	(cp) += 16;					\
604*388550b0Srillig } while (0)
605dfbf818aSplunky 
606dfbf818aSplunky #define SDP_PUT_UUID128(l, cp)	SDP_PUT128(l, cp)
607dfbf818aSplunky #else
608dfbf818aSplunky #error	"Unsupported BYTE_ORDER"
609dfbf818aSplunky #endif /* BYTE_ORDER */
610dfbf818aSplunky 
611dfbf818aSplunky struct sdp_dun_profile
612dfbf818aSplunky {
613dfbf818aSplunky 	uint8_t	server_channel;
614dfbf818aSplunky 	uint8_t	audio_feedback_support;
615dfbf818aSplunky 	uint8_t	reserved[2];
616dfbf818aSplunky };
617dfbf818aSplunky typedef struct sdp_dun_profile		sdp_dun_profile_t;
618dfbf818aSplunky typedef struct sdp_dun_profile *	sdp_dun_profile_p;
619dfbf818aSplunky 
620dfbf818aSplunky struct sdp_ftrn_profile
621dfbf818aSplunky {
622dfbf818aSplunky 	uint8_t	server_channel;
623dfbf818aSplunky 	uint8_t	reserved[3];
624dfbf818aSplunky };
625dfbf818aSplunky typedef struct sdp_ftrn_profile		sdp_ftrn_profile_t;
626dfbf818aSplunky typedef struct sdp_ftrn_profile *	sdp_ftrn_profile_p;
627dfbf818aSplunky 
628dfbf818aSplunky struct sdp_hset_profile
629dfbf818aSplunky {
630dfbf818aSplunky 	uint8_t server_channel;
631dfbf818aSplunky 	uint8_t	reserved[3];
632dfbf818aSplunky };
633dfbf818aSplunky typedef struct sdp_hset_profile		sdp_hset_profile_t;
634dfbf818aSplunky typedef struct sdp_hset_profile *	sdp_hset_profile_p;
635dfbf818aSplunky 
636dfbf818aSplunky struct sdp_hf_profile
637dfbf818aSplunky {
638dfbf818aSplunky 	uint8_t server_channel;
639dfbf818aSplunky 	uint16_t supported_features;
640dfbf818aSplunky };
641dfbf818aSplunky typedef struct sdp_hf_profile		sdp_hf_profile_t;
642dfbf818aSplunky typedef struct sdp_hf_profile *		sdp_hf_profile_p;
643dfbf818aSplunky 
644dfbf818aSplunky /* Keep this in sync with sdp_opush_profile */
645dfbf818aSplunky struct sdp_irmc_profile
646dfbf818aSplunky {
647dfbf818aSplunky 	uint8_t	server_channel;
648dfbf818aSplunky 	uint8_t	supported_formats_size;
649dfbf818aSplunky 	uint8_t	supported_formats[30];
650dfbf818aSplunky };
651dfbf818aSplunky typedef struct sdp_irmc_profile		sdp_irmc_profile_t;
652dfbf818aSplunky typedef struct sdp_irmc_profile *	sdp_irmc_profile_p;
653dfbf818aSplunky 
654dfbf818aSplunky struct sdp_irmc_command_profile
655dfbf818aSplunky {
656dfbf818aSplunky 	uint8_t	server_channel;
657dfbf818aSplunky 	uint8_t	reserved[3];
658dfbf818aSplunky };
659dfbf818aSplunky typedef struct sdp_irmc_command_profile		sdp_irmc_command_profile_t;
660dfbf818aSplunky typedef struct sdp_irmc_command_profile *	sdp_irmc_command_profile_p;
661dfbf818aSplunky 
662dfbf818aSplunky struct sdp_lan_profile
663dfbf818aSplunky {
664dfbf818aSplunky 	uint8_t		server_channel;
665dfbf818aSplunky 	uint8_t		load_factor;
666dfbf818aSplunky 	uint8_t		reserved;
667dfbf818aSplunky 	uint8_t		ip_subnet_radius;
668dfbf818aSplunky 	uint32_t	ip_subnet;
669dfbf818aSplunky };
670dfbf818aSplunky typedef struct sdp_lan_profile		sdp_lan_profile_t;
671dfbf818aSplunky typedef struct sdp_lan_profile *	sdp_lan_profile_p;
672dfbf818aSplunky 
673dfbf818aSplunky /* Keep this in sync with sdp_irmc_profile */
674dfbf818aSplunky struct sdp_opush_profile
675dfbf818aSplunky {
676dfbf818aSplunky 	uint8_t	server_channel;
677dfbf818aSplunky 	uint8_t	supported_formats_size;
678dfbf818aSplunky 	uint8_t	supported_formats[30];
679dfbf818aSplunky };
680dfbf818aSplunky typedef struct sdp_opush_profile	sdp_opush_profile_t;
681dfbf818aSplunky typedef struct sdp_opush_profile *	sdp_opush_profile_p;
682dfbf818aSplunky 
683dfbf818aSplunky struct sdp_sp_profile
684dfbf818aSplunky {
685dfbf818aSplunky 	uint8_t	server_channel;
686dfbf818aSplunky 	uint8_t	reserved[3];
687dfbf818aSplunky };
688dfbf818aSplunky typedef struct sdp_sp_profile	sdp_sp_profile_t;
689dfbf818aSplunky typedef struct sdp_sp_profile *	sdp_sp_profile_p;
690dfbf818aSplunky 
691dfbf818aSplunky struct sdp_nap_profile
692dfbf818aSplunky {
693dfbf818aSplunky 	uint8_t		reserved;
694dfbf818aSplunky 	uint8_t		load_factor;
695dfbf818aSplunky 	uint16_t	psm;
696dfbf818aSplunky 	uint16_t	security_description;
697dfbf818aSplunky 	uint16_t	net_access_type;
698dfbf818aSplunky 	uint32_t	max_net_access_rate;
699dfbf818aSplunky };
700dfbf818aSplunky typedef struct sdp_nap_profile		sdp_nap_profile_t;
701dfbf818aSplunky typedef struct sdp_nap_profile *	sdp_nap_profile_p;
702dfbf818aSplunky 
703dfbf818aSplunky struct sdp_gn_profile
704dfbf818aSplunky {
705dfbf818aSplunky 	uint8_t		reserved;
706dfbf818aSplunky 	uint8_t		load_factor;
707dfbf818aSplunky 	uint16_t	psm;
708dfbf818aSplunky 	uint16_t	security_description;
709dfbf818aSplunky 	uint16_t	reserved2;
710dfbf818aSplunky 	uint32_t	reserved3;
711dfbf818aSplunky };
712dfbf818aSplunky typedef struct sdp_gn_profile		sdp_gn_profile_t;
713dfbf818aSplunky typedef struct sdp_gn_profile *		sdp_gn_profile_p;
714dfbf818aSplunky 
715dfbf818aSplunky struct sdp_panu_profile
716dfbf818aSplunky {
717dfbf818aSplunky 	uint8_t		reserved;
718dfbf818aSplunky 	uint8_t		load_factor;
719dfbf818aSplunky 	uint16_t	psm;
720dfbf818aSplunky 	uint16_t	security_description;
721dfbf818aSplunky 	uint16_t	reserved2;
722dfbf818aSplunky 	uint32_t	reserved3;
723dfbf818aSplunky };
724dfbf818aSplunky typedef struct sdp_panu_profile		sdp_panu_profile_t;
725dfbf818aSplunky typedef struct sdp_panu_profile *	sdp_panu_profile_p;
726dfbf818aSplunky 
727dfbf818aSplunky #endif /* SDP_COMPAT */
728dfbf818aSplunky 
729dfbf818aSplunky #endif /* _SDP_H_ */
730