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