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