1 /******************************************************************************
2  *
3  *  Copyright (C) 1999-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef SDP_API_H
19 #define SDP_API_H
20 
21 #include "common/bt_target.h"
22 #include "stack/sdpdefs.h"
23 #if (SDP_INCLUDED == TRUE)
24 /*****************************************************************************
25 **  Constants
26 *****************************************************************************/
27 
28 /* Success code and error codes */
29 #define  SDP_SUCCESS                        0x0000
30 #define  SDP_INVALID_VERSION                0x0001
31 #define  SDP_INVALID_SERV_REC_HDL           0x0002
32 #define  SDP_INVALID_REQ_SYNTAX             0x0003
33 #define  SDP_INVALID_PDU_SIZE               0x0004
34 #define  SDP_INVALID_CONT_STATE             0x0005
35 #define  SDP_NO_RESOURCES                   0x0006
36 #define  SDP_DI_REG_FAILED                  0x0007
37 #define  SDP_DI_DISC_FAILED                 0x0008
38 #define  SDP_NO_DI_RECORD_FOUND             0x0009
39 #define  SDP_ERR_ATTR_NOT_PRESENT           0x000A
40 #define  SDP_ILLEGAL_PARAMETER              0x000B
41 
42 #define  SDP_NO_RECS_MATCH                  0xFFF0
43 #define  SDP_CONN_FAILED                    0xFFF1
44 #define  SDP_CFG_FAILED                     0xFFF2
45 #define  SDP_GENERIC_ERROR                  0xFFF3
46 #define  SDP_DB_FULL                        0xFFF4
47 #define  SDP_INVALID_PDU                    0xFFF5
48 #define  SDP_SECURITY_ERR                   0xFFF6
49 #define  SDP_CONN_REJECTED                  0xFFF7
50 #define  SDP_CANCEL                         0xFFF8
51 
52 /* Define the PSM that SDP uses */
53 #define SDP_PSM     0x0001
54 
55 /* Legacy #define to avoid code changes - SDP UUID is same as BT UUID */
56 #define tSDP_UUID   tBT_UUID
57 
58 /* Masks for attr_value field of tSDP_DISC_ATTR */
59 #define SDP_DISC_ATTR_LEN_MASK          0x0FFF
60 #define SDP_DISC_ATTR_TYPE(len_type)    (len_type >> 12)
61 #define SDP_DISC_ATTR_LEN(len_type)     (len_type & SDP_DISC_ATTR_LEN_MASK)
62 
63 /* Maximum number of protocol list items (list_elem in tSDP_PROTOCOL_ELEM) */
64 #define SDP_MAX_LIST_ELEMS      3
65 
66 
67 /*****************************************************************************
68 **  Type Definitions
69 *****************************************************************************/
70 
71 /* Define a callback function for when discovery is complete. */
72 typedef void (tSDP_DISC_CMPL_CB) (UINT16 result);
73 typedef void (tSDP_DISC_CMPL_CB2) (UINT16 result, void *user_data);
74 
75 typedef struct {
76     BD_ADDR         peer_addr;
77     UINT16          peer_mtu;
78 } tSDP_DR_OPEN;
79 
80 typedef struct {
81     UINT8           *p_data;
82     UINT16          data_len;
83 } tSDP_DR_DATA;
84 
85 typedef union {
86     tSDP_DR_OPEN    open;
87     tSDP_DR_DATA    data;
88 } tSDP_DATA;
89 
90 /* Define a callback function for when discovery result is received. */
91 typedef void (tSDP_DISC_RES_CB) (UINT16 event, tSDP_DATA *p_data);
92 
93 /* Define a structure to hold the discovered service information. */
94 typedef struct {
95     union {
96         UINT8       u8;                         /* 8-bit integer            */
97         UINT16      u16;                        /* 16-bit integer           */
98         UINT32      u32;                        /* 32-bit integer           */
99         UINT8       array[4];                   /* Variable length field    */
100         struct t_sdp_disc_attr *p_sub_attr;     /* Addr of first sub-attr (list)*/
101     } v;
102 
103 } tSDP_DISC_ATVAL;
104 
105 typedef struct t_sdp_disc_attr {
106     struct t_sdp_disc_attr *p_next_attr;        /* Addr of next linked attr     */
107     UINT16                  attr_id;            /* Attribute ID                 */
108     UINT16                  attr_len_type;      /* Length and type fields       */
109     tSDP_DISC_ATVAL         attr_value;         /* Variable length entry data   */
110 } tSDP_DISC_ATTR;
111 
112 typedef struct t_sdp_disc_rec {
113     tSDP_DISC_ATTR          *p_first_attr;      /* First attribute of record    */
114     struct t_sdp_disc_rec   *p_next_rec;        /* Addr of next linked record   */
115     UINT32                  time_read;          /* The time the record was read */
116     BD_ADDR                 remote_bd_addr;     /* Remote BD address            */
117 } tSDP_DISC_REC;
118 
119 typedef struct {
120     UINT32          mem_size;                   /* Memory size of the DB        */
121     UINT32          mem_free;                   /* Memory still available       */
122     tSDP_DISC_REC   *p_first_rec;               /* Addr of first record in DB   */
123     UINT16          num_uuid_filters;           /* Number of UUIds to filter    */
124     tSDP_UUID       uuid_filters[SDP_MAX_UUID_FILTERS]; /* UUIDs to filter      */
125     UINT16          num_attr_filters;           /* Number of attribute filters  */
126     UINT16          attr_filters[SDP_MAX_ATTR_FILTERS]; /* Attributes to filter */
127     UINT8           *p_free_mem;                /* Pointer to free memory       */
128 #if (SDP_RAW_DATA_INCLUDED == TRUE)
129     UINT8           *raw_data;                  /* Received record from server. allocated/released by client  */
130     UINT32          raw_size;                   /* size of raw_data */
131     UINT32          raw_used;                   /* length of raw_data used */
132 #endif
133 } tSDP_DISCOVERY_DB;
134 
135 /* This structure is used to add protocol lists and find protocol elements */
136 typedef struct {
137     UINT16      protocol_uuid;
138     UINT16      num_params;
139     UINT16      params[SDP_MAX_PROTOCOL_PARAMS];
140 } tSDP_PROTOCOL_ELEM;
141 
142 typedef struct {
143     UINT16              num_elems;
144     tSDP_PROTOCOL_ELEM  list_elem[SDP_MAX_LIST_ELEMS];
145 } tSDP_PROTO_LIST_ELEM;
146 
147 /* Device Identification (DI) data structure
148 */
149 /* Used to set the DI record */
150 typedef struct t_sdp_di_record {
151     UINT16       vendor;
152     UINT16       vendor_id_source;
153     UINT16       product;
154     UINT16       version;
155     BOOLEAN      primary_record;
156     char         client_executable_url[SDP_MAX_ATTR_LEN];   /* optional */
157     char         service_description[SDP_MAX_ATTR_LEN];     /* optional */
158     char         documentation_url[SDP_MAX_ATTR_LEN];       /* optional */
159 } tSDP_DI_RECORD;
160 
161 /* Used to get the DI record */
162 typedef struct t_sdp_di_get_record {
163     UINT16          spec_id;
164     tSDP_DI_RECORD  rec;
165 } tSDP_DI_GET_RECORD;
166 
167 
168 /*****************************************************************************
169 **  External Function Declarations
170 *****************************************************************************/
171 #ifdef __cplusplus
172 extern "C"
173 {
174 #endif
175 
176 /* API into the SDP layer for service discovery. */
177 
178 /*******************************************************************************
179 **
180 ** Function         SDP_InitDiscoveryDb
181 **
182 ** Description      This function is called to initialize a discovery database.
183 **
184 ** Returns          TRUE if successful, FALSE if one or more parameters are bad
185 **
186 *******************************************************************************/
187 extern BOOLEAN SDP_InitDiscoveryDb (tSDP_DISCOVERY_DB *p_db, UINT32 len,
188                                     UINT16 num_uuid,
189                                     tSDP_UUID *p_uuid_list,
190                                     UINT16 num_attr,
191                                     UINT16 *p_attr_list);
192 
193 /*******************************************************************************
194 **
195 ** Function         SDP_CancelServiceSearch
196 **
197 ** Description      This function cancels an active query to an SDP server.
198 **
199 ** Returns          TRUE if discovery cancelled, FALSE if a matching activity is not found.
200 **
201 *******************************************************************************/
202 extern BOOLEAN SDP_CancelServiceSearch (tSDP_DISCOVERY_DB *p_db);
203 
204 /*******************************************************************************
205 **
206 ** Function         SDP_ServiceSearchRequest
207 **
208 ** Description      This function queries an SDP server for information.
209 **
210 ** Returns          TRUE if discovery started, FALSE if failed.
211 **
212 *******************************************************************************/
213 extern BOOLEAN SDP_ServiceSearchRequest (UINT8 *p_bd_addr,
214         tSDP_DISCOVERY_DB *p_db,
215         tSDP_DISC_CMPL_CB *p_cb);
216 
217 
218 /*******************************************************************************
219 **
220 ** Function         SDP_ServiceSearchAttributeRequest
221 **
222 ** Description      This function queries an SDP server for information.
223 **
224 **                  The difference between this API function and the function
225 **                  SDP_ServiceSearchRequest2 is that this one does a
226 **                  combined ServiceSearchAttributeRequest SDP function.
227 **
228 ** Returns          TRUE if discovery started, FALSE if failed.
229 **
230 *******************************************************************************/
231 extern BOOLEAN SDP_ServiceSearchAttributeRequest (UINT8 *p_bd_addr,
232         tSDP_DISCOVERY_DB *p_db,
233         tSDP_DISC_CMPL_CB *p_cb);
234 
235 /*******************************************************************************
236 **
237 ** Function         SDP_ServiceSearchAttributeRequest2
238 **
239 ** Description      This function queries an SDP server for information.
240 **
241 **                  The difference between this API function and the function
242 **                  SDP_ServiceSearchRequest is that this one does a
243 **                  combined ServiceSearchAttributeRequest SDP function with the
244 **                  user data piggyback
245 **
246 ** Returns          TRUE if discovery started, FALSE if failed.
247 **
248 *******************************************************************************/
249 extern BOOLEAN SDP_ServiceSearchAttributeRequest2 (UINT8 *p_bd_addr,
250         tSDP_DISCOVERY_DB *p_db,
251         tSDP_DISC_CMPL_CB2 *p_cb, void *user_data);
252 
253 /* API of utilities to find data in the local discovery database */
254 
255 /*******************************************************************************
256 **
257 ** Function         SDP_FindAttributeInDb
258 **
259 ** Description      This function queries an SDP database for a specific attribute.
260 **                  If the p_start_rec pointer is NULL, it looks from the beginning
261 **                  of the database, else it continues from the next record after
262 **                  p_start_rec.
263 **
264 ** Returns          Pointer to matching record, or NULL
265 **
266 *******************************************************************************/
267 extern tSDP_DISC_REC *SDP_FindAttributeInDb (tSDP_DISCOVERY_DB *p_db,
268         UINT16 attr_id,
269         tSDP_DISC_REC *p_start_rec);
270 
271 
272 /*******************************************************************************
273 **
274 ** Function         SDP_FindAttributeInRec
275 **
276 ** Description      This function searches an SDP discovery record for a
277 **                  specific attribute.
278 **
279 ** Returns          Pointer to matching attribute entry, or NULL
280 **
281 *******************************************************************************/
282 extern tSDP_DISC_ATTR *SDP_FindAttributeInRec (tSDP_DISC_REC *p_rec,
283         UINT16 attr_id);
284 
285 
286 /*******************************************************************************
287 **
288 ** Function         SDP_FindServiceInDb
289 **
290 ** Description      This function queries an SDP database for a specific service.
291 **                  If the p_start_rec pointer is NULL, it looks from the beginning
292 **                  of the database, else it continues from the next record after
293 **                  p_start_rec.
294 **
295 ** Returns          Pointer to record containing service class, or NULL
296 **
297 *******************************************************************************/
298 extern tSDP_DISC_REC *SDP_FindServiceInDb (tSDP_DISCOVERY_DB *p_db,
299         UINT16 service_uuid,
300         tSDP_DISC_REC *p_start_rec);
301 
302 
303 /*******************************************************************************
304 **
305 ** Function         SDP_FindServiceUUIDInDb
306 **
307 ** Description      This function queries an SDP database for a specific service.
308 **                  If the p_start_rec pointer is NULL, it looks from the beginning
309 **                  of the database, else it continues from the next record after
310 **                  p_start_rec.
311 **
312 ** NOTE             the only difference between this function and the previous
313 **                  function "SDP_FindServiceInDb()" is that this function takes
314 **                  a tBT_UUID input.
315 **
316 ** Returns          Pointer to record containing service class, or NULL
317 **
318 *******************************************************************************/
319 extern tSDP_DISC_REC *SDP_FindServiceUUIDInDb (tSDP_DISCOVERY_DB *p_db,
320         tBT_UUID *p_uuid,
321         tSDP_DISC_REC *p_start_rec);
322 
323 /*******************************************************************************
324 **
325 ** Function         SDP_FindServiceUUIDInRec_128bit
326 **
327 ** Description      This function is called to read the 128-bit service UUID within a record
328 **                  if there is any.
329 **
330 ** Parameters:      p_rec      - pointer to a SDP record.
331 **                  p_uuid     - output parameter to save the UUID found.
332 **
333 ** Returns          TRUE if found, otherwise FALSE.
334 **
335 *******************************************************************************/
336 extern BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
337 
338 /*******************************************************************************
339 **
340 ** Function         SDP_FindServiceInDb_128bit
341 **
342 ** Description      This function queries an SDP database for a specific service.
343 **                  If the p_start_rec pointer is NULL, it looks from the beginning
344 **                  of the database, else it continues from the next record after
345 **                  p_start_rec.
346 **
347 ** Returns          Pointer to record containing service class, or NULL
348 **
349 *******************************************************************************/
350 extern tSDP_DISC_REC *SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB *p_db,
351         tSDP_DISC_REC *p_start_rec);
352 
353 /*******************************************************************************
354 **
355 ** Function         SDP_FindProtocolListElemInRec
356 **
357 ** Description      This function looks at a specific discovery record for a
358 **                  protocol list element.
359 **
360 ** Returns          TRUE if found, FALSE if not
361 **                  If found, the passed protocol list element is filled in.
362 **
363 *******************************************************************************/
364 extern BOOLEAN SDP_FindProtocolListElemInRec (tSDP_DISC_REC *p_rec,
365         UINT16 layer_uuid,
366         tSDP_PROTOCOL_ELEM *p_elem);
367 
368 
369 /*******************************************************************************
370 **
371 ** Function         SDP_FindAddProtoListsElemInRec
372 **
373 ** Description      This function looks at a specific discovery record for a
374 **                  protocol list element.
375 **
376 ** Returns          TRUE if found, FALSE if not
377 **                  If found, the passed protocol list element is filled in.
378 **
379 *******************************************************************************/
380 extern BOOLEAN SDP_FindAddProtoListsElemInRec (tSDP_DISC_REC *p_rec,
381         UINT16 layer_uuid,
382         tSDP_PROTOCOL_ELEM *p_elem);
383 
384 
385 /*******************************************************************************
386 **
387 ** Function         SDP_FindProfileVersionInRec
388 **
389 ** Description      This function looks at a specific discovery record for the
390 **                  Profile list descriptor, and pulls out the version number.
391 **                  The version number consists of an 8-bit major version and
392 **                  an 8-bit minor version.
393 **
394 ** Returns          TRUE if found, FALSE if not
395 **                  If found, the major and minor version numbers that were passed
396 **                  in are filled in.
397 **
398 *******************************************************************************/
399 extern BOOLEAN SDP_FindProfileVersionInRec (tSDP_DISC_REC *p_rec,
400         UINT16 profile_uuid,
401         UINT16 *p_version);
402 
403 
404 /* API into SDP for local service database updates */
405 
406 /*******************************************************************************
407 **
408 ** Function         SDP_CreateRecord
409 **
410 ** Description      This function is called to create a record in the database.
411 **                  This would be through the SDP database maintenance API. The
412 **                  record is created empty, teh application should then call
413 **                  "add_attribute" to add the record's attributes.
414 **
415 ** Returns          Record handle if OK, else 0.
416 **
417 *******************************************************************************/
418 extern UINT32 SDP_CreateRecord (void);
419 
420 
421 /*******************************************************************************
422 **
423 ** Function         SDP_DeleteRecord
424 **
425 ** Description      This function is called to add a record (or all records)
426 **                  from the database. This would be through the SDP database
427 **                  maintenance API.
428 **
429 **                  If a record handle of 0 is passed, all records are deleted.
430 **
431 ** Returns          TRUE if succeeded, else FALSE
432 **
433 *******************************************************************************/
434 extern BOOLEAN SDP_DeleteRecord (UINT32 handle);
435 
436 
437 /*******************************************************************************
438 **
439 ** Function         SDP_ReadRecord
440 **
441 ** Description      This function is called to get the raw data of the record
442 **                  with the given handle from the database.
443 **
444 ** Returns          -1, if the record is not found.
445 **                  Otherwise, the offset (0 or 1) to start of data in p_data.
446 **
447 **                  The size of data copied into p_data is in *p_data_len.
448 **
449 *******************************************************************************/
450 extern INT32 SDP_ReadRecord(UINT32 handle, UINT8 *p_data, INT32 *p_data_len);
451 
452 /*******************************************************************************
453 **
454 ** Function         SDP_AddAttribute
455 **
456 ** Description      This function is called to add an attribute to a record.
457 **                  This would be through the SDP database maintenance API.
458 **                  If the attribute already exists in the record, it is replaced
459 **                  with the new value.
460 **
461 ** NOTE             Attribute values must be passed as a Big Endian stream.
462 **
463 ** Returns          TRUE if added OK, else FALSE
464 **
465 *******************************************************************************/
466 extern BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id,
467                                  UINT8 attr_type, UINT32 attr_len,
468                                  UINT8 *p_val);
469 
470 
471 /*******************************************************************************
472 **
473 ** Function         SDP_AddSequence
474 **
475 ** Description      This function is called to add a sequence to a record.
476 **                  This would be through the SDP database maintenance API.
477 **                  If the sequence already exists in the record, it is replaced
478 **                  with the new sequence.
479 **
480 ** NOTE             Element values must be passed as a Big Endian stream.
481 **
482 ** Returns          TRUE if added OK, else FALSE
483 **
484 *******************************************************************************/
485 extern BOOLEAN SDP_AddSequence (UINT32 handle,  UINT16 attr_id,
486                                 UINT16 num_elem, UINT8 type[],
487                                 UINT8 len[], UINT8 *p_val[]);
488 
489 
490 /*******************************************************************************
491 **
492 ** Function         SDP_AddUuidSequence
493 **
494 ** Description      This function is called to add a UUID sequence to a record.
495 **                  This would be through the SDP database maintenance API.
496 **                  If the sequence already exists in the record, it is replaced
497 **                  with the new sequence.
498 **
499 ** Returns          TRUE if added OK, else FALSE
500 **
501 *******************************************************************************/
502 extern BOOLEAN SDP_AddUuidSequence (UINT32 handle,  UINT16 attr_id,
503                                     UINT16 num_uuids, UINT16 *p_uuids);
504 
505 
506 /*******************************************************************************
507 **
508 ** Function         SDP_AddProtocolList
509 **
510 ** Description      This function is called to add a protocol descriptor list to
511 **                  a record. This would be through the SDP database maintenance API.
512 **                  If the protocol list already exists in the record, it is replaced
513 **                  with the new list.
514 **
515 ** Returns          TRUE if added OK, else FALSE
516 **
517 *******************************************************************************/
518 extern BOOLEAN SDP_AddProtocolList (UINT32 handle, UINT16 num_elem,
519                                     tSDP_PROTOCOL_ELEM *p_elem_list);
520 
521 
522 /*******************************************************************************
523 **
524 ** Function         SDP_AddAdditionProtoLists
525 **
526 ** Description      This function is called to add a protocol descriptor list to
527 **                  a record. This would be through the SDP database maintenance API.
528 **                  If the protocol list already exists in the record, it is replaced
529 **                  with the new list.
530 **
531 ** Returns          TRUE if added OK, else FALSE
532 **
533 *******************************************************************************/
534 extern BOOLEAN SDP_AddAdditionProtoLists (UINT32 handle, UINT16 num_elem,
535         tSDP_PROTO_LIST_ELEM *p_proto_list);
536 
537 
538 /*******************************************************************************
539 **
540 ** Function         SDP_AddProfileDescriptorList
541 **
542 ** Description      This function is called to add a profile descriptor list to
543 **                  a record. This would be through the SDP database maintenance API.
544 **                  If the version already exists in the record, it is replaced
545 **                  with the new one.
546 **
547 ** Returns          TRUE if added OK, else FALSE
548 **
549 *******************************************************************************/
550 extern BOOLEAN SDP_AddProfileDescriptorList (UINT32 handle,
551         UINT16 profile_uuid,
552         UINT16 version);
553 
554 
555 /*******************************************************************************
556 **
557 ** Function         SDP_AddLanguageBaseAttrIDList
558 **
559 ** Description      This function is called to add a language base attr list to
560 **                  a record. This would be through the SDP database maintenance API.
561 **                  If the version already exists in the record, it is replaced
562 **                  with the new one.
563 **
564 ** Returns          TRUE if added OK, else FALSE
565 **
566 *******************************************************************************/
567 extern BOOLEAN SDP_AddLanguageBaseAttrIDList (UINT32 handle,
568         UINT16 lang, UINT16 char_enc,
569         UINT16 base_id);
570 
571 
572 /*******************************************************************************
573 **
574 ** Function         SDP_AddServiceClassIdList
575 **
576 ** Description      This function is called to add a service list to a record.
577 **                  This would be through the SDP database maintenance API.
578 **                  If the service list already exists in the record, it is replaced
579 **                  with the new list.
580 **
581 ** Returns          TRUE if added OK, else FALSE
582 **
583 *******************************************************************************/
584 extern BOOLEAN SDP_AddServiceClassIdList (UINT32 handle,
585         UINT16 num_services,
586         UINT16 *p_service_uuids);
587 
588 
589 /*******************************************************************************
590 **
591 ** Function         SDP_DeleteAttribute
592 **
593 ** Description      This function is called to delete an attribute from a record.
594 **                  This would be through the SDP database maintenance API.
595 **
596 ** Returns          TRUE if deleted OK, else FALSE if not found
597 **
598 *******************************************************************************/
599 extern BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id);
600 
601 
602 /* Device Identification APIs */
603 
604 /*******************************************************************************
605 **
606 ** Function         SDP_SetLocalDiRecord
607 **
608 ** Description      This function adds a DI record to the local SDP database.
609 **
610 ** Returns          Returns SDP_SUCCESS if record added successfully, else error
611 **
612 *******************************************************************************/
613 extern UINT16 SDP_SetLocalDiRecord (tSDP_DI_RECORD *device_info,
614                                     UINT32 *p_handle);
615 
616 /*******************************************************************************
617 **
618 ** Function         SDP_DiDiscover
619 **
620 ** Description      This function queries a remote device for DI information.
621 **
622 ** Returns          SDP_SUCCESS if query started successfully, else error
623 **
624 *******************************************************************************/
625 extern UINT16 SDP_DiDiscover (BD_ADDR remote_device,
626                               tSDP_DISCOVERY_DB *p_db, UINT32 len,
627                               tSDP_DISC_CMPL_CB *p_cb);
628 
629 
630 /*******************************************************************************
631 **
632 ** Function         SDP_GetNumDiRecords
633 **
634 ** Description      Searches specified database for DI records
635 **
636 ** Returns          number of DI records found
637 **
638 *******************************************************************************/
639 extern UINT8  SDP_GetNumDiRecords (tSDP_DISCOVERY_DB *p_db);
640 
641 
642 /*******************************************************************************
643 **
644 ** Function         SDP_GetDiRecord
645 **
646 ** Description      This function retrieves a remote device's DI record from
647 **                  the specified database.
648 **
649 ** Returns          SDP_SUCCESS if record retrieved, else error
650 **
651 *******************************************************************************/
652 extern UINT16 SDP_GetDiRecord (UINT8 getRecordIndex,
653                                tSDP_DI_GET_RECORD *device_info,
654                                tSDP_DISCOVERY_DB *p_db);
655 
656 
657 /*******************************************************************************
658 **
659 ** Function         SDP_SetTraceLevel
660 **
661 ** Description      This function sets the trace level for SDP. If called with
662 **                  a value of 0xFF, it simply reads the current trace level.
663 **
664 ** Returns          the new (current) trace level
665 **
666 *******************************************************************************/
667 extern UINT8 SDP_SetTraceLevel (UINT8 new_level);
668 
669 /*******************************************************************************
670 **
671 ** Function         SDP_ConnOpen
672 **
673 ** Description      This function creates a connection to the SDP server on the
674 **                  given device.
675 **
676 ** Returns          0, if failed to initiate connection. Otherwise, the handle.
677 **
678 *******************************************************************************/
679 UINT32 SDP_ConnOpen (UINT8 *p_bd_addr, tSDP_DISC_RES_CB *p_rcb,
680                      tSDP_DISC_CMPL_CB *p_cb);
681 
682 /*******************************************************************************
683 **
684 ** Function         SDP_WriteData
685 **
686 ** Description      This function sends data to the connected SDP server.
687 **
688 ** Returns          TRUE if data is sent, FALSE if failed.
689 **
690 *******************************************************************************/
691 BOOLEAN SDP_WriteData (UINT32 handle, BT_HDR  *p_msg);
692 
693 /*******************************************************************************
694 **
695 ** Function         SDP_ConnClose
696 **
697 ** Description      This function is called to close a SDP connection.
698 **
699 ** Parameters:      handle      - Handle of the connection returned by SDP_ConnOpen
700 **
701 ** Returns          TRUE if connection is closed, FALSE if failed to find the handle.
702 **
703 *******************************************************************************/
704 BOOLEAN SDP_ConnClose (UINT32 handle);
705 
706 /*******************************************************************************
707 **
708 ** Function         SDP_FindServiceUUIDInRec
709 **
710 ** Description      This function is called to read the service UUID within a record
711 **                  if there is any.
712 **
713 ** Parameters:      p_rec      - pointer to a SDP record.
714 **
715 ** Returns          TRUE if found, otherwise FALSE.
716 **
717 *******************************************************************************/
718 BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
719 
720 #ifdef __cplusplus
721 }
722 #endif
723 
724 #endif  ///SDP_INCLUDED == TRUE
725 
726 #endif  /* SDP_API_H */
727