xref: /freebsd/lib/libsdp/sdp.h (revision 7773002178c8dbc52b44e4d705f07706409af8e4)
1 /*
2  * sdp.h
3  *
4  * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $Id: sdp.h,v 1.3 2003/09/05 00:33:59 max Exp $
29  * $FreeBSD$
30  */
31 
32 #ifndef _SDP_H_
33 #define _SDP_H_
34 
35 __BEGIN_DECLS
36 
37 /*
38  * Data representation (page 349)
39  */
40 
41 /* Nil, the null type */
42 #define SDP_DATA_NIL					0x00
43 
44 /* Unsigned integer */
45 #define SDP_DATA_UINT8					0x08
46 #define SDP_DATA_UINT16					0x09
47 #define SDP_DATA_UINT32					0x0A
48 #define SDP_DATA_UINT64					0x0B
49 #define SDP_DATA_UINT128				0x0C
50 
51 /* Signed two's-complement integer */
52 #define SDP_DATA_INT8					0x10
53 #define SDP_DATA_INT16					0x11
54 #define SDP_DATA_INT32					0x12
55 #define SDP_DATA_INT64					0x13
56 #define SDP_DATA_INT128					0x14
57 
58 /* UUID, a universally unique identifier */
59 #define SDP_DATA_UUID16					0x19
60 #define SDP_DATA_UUID32					0x1A
61 #define SDP_DATA_UUID128				0x1C
62 
63 /* Text string */
64 #define SDP_DATA_STR8					0x25
65 #define SDP_DATA_STR16					0x26
66 #define SDP_DATA_STR32					0x27
67 
68 /* Boolean */
69 #define SDP_DATA_BOOL					0x28
70 
71 /*
72  * Data element sequence.
73  * A data element whose data field is a sequence of data elements
74  */
75 #define SDP_DATA_SEQ8					0x35
76 #define SDP_DATA_SEQ16					0x36
77 #define SDP_DATA_SEQ32					0x37
78 
79 /*
80  * Data element alternative.
81  * A data element whose data field is a sequence of data elements from
82  * which one data element is to be selected.
83  */
84 #define SDP_DATA_ALT8					0x3D
85 #define SDP_DATA_ALT16					0x3E
86 #define SDP_DATA_ALT32					0x3F
87 
88 /* URL, a uniform resource locator */
89 #define SDP_DATA_URL8					0x45
90 #define SDP_DATA_URL16					0x46
91 #define SDP_DATA_URL32					0x47
92 
93 /*
94  * Protocols UUID (short) http://www.bluetoothsig.org/assigned-numbers/sdp.htm
95  * BASE UUID 00000000-0000-1000-8000-00805F9B34FB
96  */
97 
98 #define SDP_UUID_PROTOCOL_SDP				0x0001
99 #define SDP_UUID_PROTOCOL_UDP				0x0002
100 #define SDP_UUID_PROTOCOL_RFCOMM			0x0003
101 #define SDP_UUID_PROTOCOL_TCP				0x0004
102 #define SDP_UUID_PROTOCOL_TCS_BIN			0x0005
103 #define SDP_UUID_PROTOCOL_TCS_AT			0x0006
104 #define SDP_UUID_PROTOCOL_OBEX				0x0008
105 #define SDP_UUID_PROTOCOL_IP				0x0009
106 #define SDP_UUID_PROTOCOL_FTP				0x000A
107 #define SDP_UUID_PROTOCOL_HTTP				0x000C
108 #define SDP_UUID_PROTOCOL_WSP				0x000E
109 #define SDP_UUID_PROTOCOL_BNEP				0x000F
110 #define SDP_UUID_PROTOCOL_UPNP				0x0010
111 #define SDP_UUID_PROTOCOL_HIDP				0x0011
112 #define SDP_UUID_PROTOCOL_HARDCOPY_CONTROL_CHANNEL	0x0012
113 #define SDP_UUID_PROTOCOL_HARDCOPY_DATA_CHANNEL		0x0014
114 #define SDP_UUID_PROTOCOL_HARDCOPY_NOTIFICATION		0x0016
115 #define SDP_UUID_PROTOCOL_AVCTP				0x0017
116 #define SDP_UUID_PROTOCOL_AVDTP				0x0019
117 #define SDP_UUID_PROTOCOL_CMPT				0x001B
118 #define SDP_UUID_PROTOCOL_UDI_C_PLANE			0x001D
119 #define SDP_UUID_PROTOCOL_L2CAP				0x0100
120 
121 /*
122  * Service class IDs http://www.bluetoothsig.org/assigned-numbers/sdp.htm
123  */
124 
125 #define SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER	0x1000
126 #define SDP_SERVICE_CLASS_BROWSE_GROUP_DESCRIPTOR	0x1001
127 #define SDP_SERVICE_CLASS_PUBLIC_BROWSE_GROUP		0x1002
128 #define SDP_SERVICE_CLASS_SERIAL_PORT			0x1101
129 #define SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP		0x1102
130 #define SDP_SERVICE_CLASS_DIALUP_NETWORKING		0x1103
131 #define SDP_SERVICE_CLASS_IR_MC_SYNC			0x1104
132 #define SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH		0x1105
133 #define SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER		0x1106
134 #define SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND		0x1107
135 #define SDP_SERVICE_CLASS_HEADSET			0x1108
136 #define SDP_SERVICE_CLASS_CORDLESS_TELEPHONY		0x1109
137 #define SDP_SERVICE_CLASS_AUDIO_SOURCE			0x110A
138 #define SDP_SERVICE_CLASS_AUDIO_SINK			0x110B
139 #define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_TARGET	0x110C
140 #define SDP_SERVICE_CLASS_ADVANCED_AUDIO_DISTRIBUTION	0x110D
141 #define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL		0x110E
142 #define SDP_SERVICE_CLASS_VIDEO_CONFERENCING		0x110F
143 #define SDP_SERVICE_CLASS_INTERCOM			0x1110
144 #define SDP_SERVICE_CLASS_FAX				0x1111
145 #define SDP_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY		0x1112
146 #define SDP_SERVICE_CLASS_WAP				0x1113
147 #define SDP_SERVICE_CLASS_WAP_CLIENT			0x1114
148 #define SDP_SERVICE_CLASS_PANU				0x1115
149 #define SDP_SERVICE_CLASS_NAP				0x1116
150 #define SDP_SERVICE_CLASS_GN				0x1117
151 #define SDP_SERVICE_CLASS_DIRECT_PRINTING		0x1118
152 #define SDP_SERVICE_CLASS_REFERENCE_PRINTING		0x1119
153 #define SDP_SERVICE_CLASS_IMAGING			0x111A
154 #define SDP_SERVICE_CLASS_IMAGING_RESPONDER		0x111B
155 #define SDP_SERVICE_CLASS_IMAGING_AUTOMATIC_ARCHIVE	0x111C
156 #define SDP_SERVICE_CLASS_IMAGING_REFERENCED_OBJECTS	0x111D
157 #define SDP_SERVICE_CLASS_HANDSFREE			0x111E
158 #define SDP_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY	0x111F
159 #define SDP_SERVICE_CLASS_DIRECT_PRINTING_REFERENCE_OBJECTS	0x1120
160 #define SDP_SERVICE_CLASS_REFLECTED_UI			0x1121
161 #define SDP_SERVICE_CLASS_BASIC_PRINTING		0x1122
162 #define SDP_SERVICE_CLASS_PRINTING_STATUS		0x1123
163 #define SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE	0x1124
164 #define SDP_SERVICE_CLASS_HARDCOPY_CABLE_REPLACEMENT	0x1125
165 #define SDP_SERVICE_CLASS_HCR_PRINT			0x1126
166 #define SDP_SERVICE_CLASS_HCR_SCAN			0x1127
167 #define SDP_SERVICE_CLASS_COMMON_ISDN_ACCESS		0x1128
168 #define SDP_SERVICE_CLASS_VIDEO_CONFERENCING_GW		0x1129
169 #define SDP_SERVICE_CLASS_UDI_MT			0x112A
170 #define SDP_SERVICE_CLASS_UDI_TA			0x112B
171 #define SDP_SERVICE_CLASS_AUDIO_VIDEO			0x112C
172 #define SDP_SERVICE_CLASS_SIM_ACCESS			0x112D
173 #define SDP_SERVICE_CLASS_PNP_INFORMATION		0x1200
174 #define SDP_SERVICE_CLASS_GENERIC_NETWORKING		0x1201
175 #define SDP_SERVICE_CLASS_GENERIC_FILE_TRANSFER		0x1202
176 #define SDP_SERVICE_CLASS_GENERIC_AUDIO			0x1203
177 #define SDP_SERVICE_CLASS_GENERIC_TELEPHONY		0x1204
178 #define SDP_SERVICE_CLASS_UPNP				0x1205
179 #define SDP_SERVICE_CLASS_UPNP_IP			0x1206
180 #define SDP_SERVICE_CLASS_ESDP_UPNP_IP_PAN		0x1300
181 #define SDP_SERVICE_CLASS_ESDP_UPNP_IP_LAP		0x1301
182 #define SDP_SERVICE_CLASS_ESDP_UPNP_L2CAP		0x1302
183 
184 /*
185  * Universal attribute definitions (page 366) and
186  * http://www.bluetoothsig.org/assigned-numbers/sdp.htm
187  */
188 
189 #define SDP_ATTR_RANGE(lo, hi) \
190 	(u_int32_t)(((u_int16_t)(lo) << 16) | ((u_int16_t)(hi)))
191 
192 #define SDP_ATTR_SERVICE_RECORD_HANDLE			0x0000
193 #define SDP_ATTR_SERVICE_CLASS_ID_LIST			0x0001
194 #define SDP_ATTR_SERVICE_RECORD_STATE			0x0002
195 #define SDP_ATTR_SERVICE_ID				0x0003
196 #define SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST		0x0004
197 #define SDP_ATTR_BROWSE_GROUP_LIST			0x0005
198 #define SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST	0x0006
199 #define SDP_ATTR_SERVICE_INFO_TIME_TO_LIVE		0x0007
200 #define SDP_ATTR_SERVICE_AVAILABILITY			0x0008
201 #define SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST	0x0009
202 #define SDP_ATTR_DOCUMENTATION_URL			0x000A
203 #define SDP_ATTR_CLIENT_EXECUTABLE_URL			0x000B
204 #define SDP_ATTR_ICON_URL				0x000C
205 #define SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS	0x000D
206 #define SDP_ATTR_GROUP_ID				0x0200
207 #define SDP_ATTR_IP_SUBNET				0x0200
208 #define SDP_ATTR_VERSION_NUMBER_LIST			0x0200
209 #define SDP_ATTR_SERVICE_DATABASE_STATE			0x0201
210 #define SDP_ATTR_SERVICE_VERSION			0x0300
211 #define SDP_ATTR_EXTERNAL_NETWORK			0x0301
212 #define SDP_ATTR_NETWORK				0x0301
213 #define SDP_ATTR_SUPPORTED_DATA_STORES_LIST		0x0301
214 #define SDP_ATTR_FAX_CLASS1_SUPPORT			0x0302
215 #define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL		0x0302
216 #define SDP_ATTR_FAX_CLASS20_SUPPORT			0x0303
217 #define SDP_ATTR_SUPPORTED_FORMATS_LIST			0x0303
218 #define SDP_ATTR_FAX_CLASS2_SUPPORT			0x0304
219 #define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT			0x0305
220 #define SDP_ATTR_NETWORK_ADDRESS			0x0306
221 #define SDP_ATTR_WAP_GATEWAY				0x0307
222 #define SDP_ATTR_HOME_PAGE_URL				0x0308
223 #define SDP_ATTR_WAP_STACK_TYPE				0x0309
224 #define SDP_ATTR_SECURITY_DESCRIPTION			0x030A
225 #define SDP_ATTR_NET_ACCESS_TYPE			0x030B
226 #define SDP_ATTR_MAX_NET_ACCESS_RATE			0x030C
227 #define SDP_ATTR_IPV4_SUBNET				0x030D
228 #define SDP_ATTR_IPV6_SUBNET				0x030E
229 #define SDP_ATTR_SUPPORTED_CAPABALITIES			0x0310
230 #define SDP_ATTR_SUPPORTED_FEATURES			0x0311
231 #define SDP_ATTR_SUPPORTED_FUNCTIONS			0x0312
232 #define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY		0x0313
233 
234 /*
235  * The offset must be added to the attribute ID base (contained in the
236  * LANGUAGE_BASE_ATTRIBUTE_ID_LIST attribute) in order to compute the
237  * attribute ID for these attributes.
238  */
239 
240 #define SDP_ATTR_SERVICE_NAME_OFFSET			0x0000
241 #define SDP_ATTR_SERVICE_DESCRIPTION_OFFSET		0x0001
242 #define SDP_ATTR_PROVIDER_NAME_OFFSET			0x0002
243 
244 /*
245  * Protocol data unit (PDU) format (page 352)
246  */
247 
248 #define SDP_PDU_ERROR_RESPONSE				0x01
249 #define SDP_PDU_SERVICE_SEARCH_REQUEST			0x02
250 #define SDP_PDU_SERVICE_SEARCH_RESPONSE			0x03
251 #define SDP_PDU_SERVICE_ATTRIBUTE_REQUEST		0x04
252 #define SDP_PDU_SERVICE_ATTRIBUTE_RESPONSE		0x05
253 #define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST	0x06
254 #define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_RESPONSE	0x07
255 
256 struct sdp_pdu {
257 	u_int8_t	pid;	/* PDU ID - SDP_PDU_xxx */
258 	u_int16_t	tid;	/* transaction ID */
259 	u_int16_t	len;	/* parameters length (in bytes) */
260 } __attribute__ ((packed));
261 typedef struct sdp_pdu		sdp_pdu_t;
262 typedef struct sdp_pdu *	sdp_pdu_p;
263 
264 /*
265  * SDP int128/uint128 parameter
266  */
267 
268 struct int128 {
269 	int8_t	b[16];
270 };
271 typedef struct int128	int128_t;
272 typedef struct int128	u_int128_t;
273 
274 /*
275  * SDP attribute
276  */
277 
278 struct sdp_attr {
279 	u_int16_t	 flags;
280 #define SDP_ATTR_OK		(0 << 0)
281 #define SDP_ATTR_INVALID	(1 << 0)
282 #define SDP_ATTR_TRUNCATED	(1 << 1)
283 	u_int16_t	 attr;  /* SDP_ATTR_xxx */
284 	u_int32_t	 vlen;	/* length of the value[] in bytes */
285 	u_int8_t	*value;	/* base pointer */
286 };
287 typedef struct sdp_attr		sdp_attr_t;
288 typedef struct sdp_attr *	sdp_attr_p;
289 
290 /******************************************************************************
291  * User interface
292  *****************************************************************************/
293 
294 /* Inline versions of get/put byte/short/long. Pointer is advanced */
295 #define SDP_GET8(b, cp) { \
296 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
297 	(b) = *t_cp; \
298 	(cp) ++; \
299 }
300 
301 #define SDP_GET16(s, cp) { \
302 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
303 	(s) = ((u_int16_t)t_cp[0] << 8) \
304 	    | ((u_int16_t)t_cp[1]) \
305 	    ; \
306 	(cp) += 2; \
307 }
308 
309 #define SDP_GET32(l, cp) { \
310 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
311 	(l) = ((u_int32_t)t_cp[0] << 24) \
312 	    | ((u_int32_t)t_cp[1] << 16) \
313 	    | ((u_int32_t)t_cp[2] << 8) \
314 	    | ((u_int32_t)t_cp[3]) \
315 	    ; \
316 	(cp) += 4; \
317 }
318 
319 #define SDP_GET64(l, cp) { \
320 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
321 	(l) = ((u_int64_t)t_cp[0] << 56) \
322 	    | ((u_int64_t)t_cp[1] << 48) \
323 	    | ((u_int64_t)t_cp[2] << 40) \
324 	    | ((u_int64_t)t_cp[3] << 32) \
325 	    | ((u_int64_t)t_cp[4] << 24) \
326 	    | ((u_int64_t)t_cp[5] << 16) \
327 	    | ((u_int64_t)t_cp[6] << 8) \
328 	    | ((u_int64_t)t_cp[7]) \
329 	    ; \
330 	(cp) += 8; \
331 }
332 
333 #if BYTE_ORDER == LITTLE_ENDIAN
334 #define SDP_GET128(l, cp) { \
335 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
336 	(l)->b[15] = *t_cp++; \
337 	(l)->b[14] = *t_cp++; \
338 	(l)->b[13] = *t_cp++; \
339 	(l)->b[12] = *t_cp++; \
340 	(l)->b[11] = *t_cp++; \
341 	(l)->b[10] = *t_cp++; \
342 	(l)->b[9]  = *t_cp++; \
343 	(l)->b[8]  = *t_cp++; \
344 	(l)->b[7]  = *t_cp++; \
345 	(l)->b[6]  = *t_cp++; \
346 	(l)->b[5]  = *t_cp++; \
347 	(l)->b[4]  = *t_cp++; \
348 	(l)->b[3]  = *t_cp++; \
349 	(l)->b[2]  = *t_cp++; \
350 	(l)->b[1]  = *t_cp++; \
351 	(cp) += 16; \
352 }
353 #else /* BYTE_ORDER != LITTLE_ENDIAN */
354 #define SDP_GET128(l, cp) { \
355 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
356 	(l)->b[0]  = *t_cp++; \
357 	(l)->b[1]  = *t_cp++; \
358 	(l)->b[2]  = *t_cp++; \
359 	(l)->b[3]  = *t_cp++; \
360 	(l)->b[4]  = *t_cp++; \
361 	(l)->b[5]  = *t_cp++; \
362 	(l)->b[6]  = *t_cp++; \
363 	(l)->b[7]  = *t_cp++; \
364 	(l)->b[8]  = *t_cp++; \
365 	(l)->b[9]  = *t_cp++; \
366 	(l)->b[10] = *t_cp++; \
367 	(l)->b[11] = *t_cp++; \
368 	(l)->b[12] = *t_cp++; \
369 	(l)->b[13] = *t_cp++; \
370 	(l)->b[14] = *t_cp++; \
371 	(l)->b[15] = *t_cp++; \
372 	(cp) += 16; \
373 }
374 #endif /* BYTE_ORDER */
375 
376 #define SDP_PUT8(b, cp) { \
377 	register u_int8_t t_b = (u_int8_t)(b); \
378 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
379 	*t_cp = t_b; \
380 	(cp) ++; \
381 }
382 
383 #define SDP_PUT16(s, cp) { \
384 	register u_int16_t t_s = (u_int16_t)(s); \
385 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
386 	*t_cp++ = t_s >> 8; \
387 	*t_cp   = t_s; \
388 	(cp) += 2; \
389 }
390 
391 #define SDP_PUT32(l, cp) { \
392 	register u_int32_t t_l = (u_int32_t)(l); \
393 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
394 	*t_cp++ = t_l >> 24; \
395 	*t_cp++ = t_l >> 16; \
396 	*t_cp++ = t_l >> 8; \
397 	*t_cp   = t_l; \
398 	(cp) += 4; \
399 }
400 
401 #define SDP_PUT64(l, cp) { \
402 	register u_int64_t t_l = (u_int64_t)(l); \
403 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
404 	*t_cp++ = t_l >> 56; \
405 	*t_cp++ = t_l >> 48; \
406 	*t_cp++ = t_l >> 40; \
407 	*t_cp++ = t_l >> 32; \
408 	*t_cp++ = t_l >> 24; \
409 	*t_cp++ = t_l >> 16; \
410 	*t_cp++ = t_l >> 8; \
411 	*t_cp   = t_l; \
412 	(cp) += 8; \
413 }
414 
415 #if BYTE_ORDER == LITTLE_ENDIAN
416 #define SDP_PUT128(l, cp) { \
417 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
418 	*t_cp++ = (l)->b[15]; \
419 	*t_cp++ = (l)->b[14]; \
420 	*t_cp++ = (l)->b[13]; \
421 	*t_cp++ = (l)->b[12]; \
422 	*t_cp++ = (l)->b[11]; \
423 	*t_cp++ = (l)->b[10]; \
424 	*t_cp++ = (l)->b[9];  \
425 	*t_cp++ = (l)->b[8];  \
426 	*t_cp++ = (l)->b[7];  \
427 	*t_cp++ = (l)->b[6];  \
428 	*t_cp++ = (l)->b[5];  \
429 	*t_cp++ = (l)->b[4];  \
430 	*t_cp++ = (l)->b[3];  \
431 	*t_cp++ = (l)->b[2];  \
432 	*t_cp++ = (l)->b[1];  \
433 	*t_cp   = (l)->b[0];  \
434 	(cp) += 16; \
435 }
436 #else /* BYTE_ORDER != LITTLE_ENDIAN */
437 #define SDP_PUT128(l, cp) { \
438 	register u_int8_t *t_cp = (u_int8_t *)(cp); \
439 	*t_cp++ = (l)->b[0];  \
440 	*t_cp++ = (l)->b[1];  \
441 	*t_cp++ = (l)->b[2];  \
442 	*t_cp++ = (l)->b[3];  \
443 	*t_cp++ = (l)->b[4];  \
444 	*t_cp++ = (l)->b[5];  \
445 	*t_cp++ = (l)->b[6];  \
446 	*t_cp++ = (l)->b[7];  \
447 	*t_cp++ = (l)->b[8];  \
448 	*t_cp++ = (l)->b[9];  \
449 	*t_cp++ = (l)->b[10]; \
450 	*t_cp++ = (l)->b[11]; \
451 	*t_cp++ = (l)->b[12]; \
452 	*t_cp++ = (l)->b[13]; \
453 	*t_cp++ = (l)->b[14]; \
454 	*t_cp   = (l)->b[15]; \
455 	(cp) += 16; \
456 }
457 #endif /* BYTE_ORDER */
458 
459 void *             sdp_open       (bdaddr_t const *l, bdaddr_t const *r);
460 void *             sdp_open_local (void);
461 int32_t            sdp_close      (void *xs);
462 int32_t            sdp_error      (void *xs);
463 
464 int32_t            sdp_search     (void *xs,
465                                    u_int32_t plen, u_int16_t const *pp,
466                                    u_int32_t alen, u_int32_t const *ap,
467                                    u_int32_t vlen, sdp_attr_t *vp);
468 
469 char const * const sdp_attr2desc  (u_int16_t attr);
470 char const * const sdp_uuid2desc  (u_int16_t uuid);
471 void               sdp_print      (u_int32_t level, u_int8_t const *start,
472                                    u_int8_t const *end);
473 
474 __END_DECLS
475 
476 #endif /* ndef _SDP_H_ */
477 
478