Coverage Report

Created: 2025-11-16 07:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/usr/include/bluetooth/sdp_lib.h
Line
Count
Source
1
/*
2
 *
3
 *  BlueZ - Bluetooth protocol stack for Linux
4
 *
5
 *  Copyright (C) 2001-2002  Nokia Corporation
6
 *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
7
 *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
8
 *  Copyright (C) 2002-2003  Stephen Crane <steve.crane@rococosoft.com>
9
 *
10
 *
11
 *  This program is free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 2 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  This program is distributed in the hope that it will be useful,
17
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 *  GNU General Public License for more details.
20
 *
21
 *  You should have received a copy of the GNU General Public License
22
 *  along with this program; if not, write to the Free Software
23
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24
 *
25
 */
26
27
#ifndef __SDP_LIB_H
28
#define __SDP_LIB_H
29
30
#include <sys/socket.h>
31
#include <bluetooth/bluetooth.h>
32
#include <bluetooth/hci.h>
33
34
#ifdef __cplusplus
35
extern "C" {
36
#endif
37
38
/*
39
 * SDP lists
40
 */
41
typedef void(*sdp_list_func_t)(void *, void *);
42
typedef void(*sdp_free_func_t)(void *);
43
typedef int (*sdp_comp_func_t)(const void *, const void *);
44
45
sdp_list_t *sdp_list_append(sdp_list_t *list, void *d);
46
sdp_list_t *sdp_list_remove(sdp_list_t *list, void *d);
47
sdp_list_t *sdp_list_insert_sorted(sdp_list_t *list, void *data, sdp_comp_func_t f);
48
void        sdp_list_free(sdp_list_t *list, sdp_free_func_t f);
49
50
static inline int sdp_list_len(const sdp_list_t *list)
51
0
{
52
0
  int n = 0;
53
0
  for (; list; list = list->next)
54
0
    n++;
55
0
  return n;
56
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_list_len
Unexecuted instantiation: fuzz_xml.c:sdp_list_len
Unexecuted instantiation: fuzz_hci.c:sdp_list_len
57
58
static inline sdp_list_t *sdp_list_find(sdp_list_t *list, void *u, sdp_comp_func_t f)
59
0
{
60
0
  for (; list; list = list->next)
61
0
    if (f(list->data, u) == 0)
62
0
      return list;
63
0
  return NULL;
64
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_list_find
Unexecuted instantiation: fuzz_xml.c:sdp_list_find
Unexecuted instantiation: fuzz_hci.c:sdp_list_find
65
66
static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u)
67
0
{
68
0
  for (; list; list = list->next)
69
0
    f(list->data, u);
70
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_list_foreach
Unexecuted instantiation: fuzz_xml.c:sdp_list_foreach
Unexecuted instantiation: fuzz_hci.c:sdp_list_foreach
71
72
/*
73
 * Values of the flags parameter to sdp_record_register
74
 */
75
#define SDP_RECORD_PERSIST  0x01
76
#define SDP_DEVICE_RECORD 0x02
77
78
/*
79
 * Values of the flags parameter to sdp_connect
80
 */
81
#define SDP_RETRY_IF_BUSY 0x01
82
#define SDP_WAIT_ON_CLOSE 0x02
83
#define SDP_NON_BLOCKING  0x04
84
#define SDP_LARGE_MTU   0x08
85
86
/*
87
 * a session with an SDP server
88
 */
89
typedef struct {
90
  int sock;
91
  int state;
92
  int local;
93
  int flags;
94
  uint16_t tid; /* Current transaction ID */
95
  void *priv;
96
} sdp_session_t;
97
98
typedef enum {
99
  /*
100
   *  Attributes are specified as individual elements
101
   */
102
  SDP_ATTR_REQ_INDIVIDUAL = 1,
103
  /*
104
   *  Attributes are specified as a range
105
   */
106
  SDP_ATTR_REQ_RANGE
107
} sdp_attrreq_type_t;
108
109
/*
110
 *  When the pdu_id(type) is a sdp error response, check the status value
111
 *  to figure out the error reason. For status values 0x0001-0x0006 check
112
 *  Bluetooth SPEC. If the status is 0xffff, call sdp_get_error function
113
 *  to get the real reason:
114
 *      - wrong transaction ID(EPROTO)
115
 *      - wrong PDU id or(EPROTO)
116
 *      - I/O error
117
 */
118
typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata);
119
120
/*
121
 * create an L2CAP connection to a Bluetooth device
122
 *
123
 * INPUT:
124
 *
125
 *  bdaddr_t *src:
126
 *  Address of the local device to use to make the connection
127
 *  (or BDADDR_ANY)
128
 *
129
 *  bdaddr_t *dst:
130
 *    Address of the SDP server device
131
 */
132
sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags);
133
int sdp_close(sdp_session_t *session);
134
int sdp_get_socket(const sdp_session_t *session);
135
136
/*
137
 * SDP transaction: functions for asynchronous search.
138
 */
139
sdp_session_t *sdp_create(int sk, uint32_t flags);
140
int sdp_get_error(sdp_session_t *session);
141
int sdp_process(sdp_session_t *session);
142
int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata);
143
144
int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num);
145
int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
146
int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
147
148
uint16_t sdp_gen_tid(sdp_session_t *session);
149
150
/*
151
 * find all devices in the piconet
152
 */
153
int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found);
154
155
/* flexible extraction of basic attributes - Jean II */
156
int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value);
157
int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen);
158
159
/*
160
 * Basic sdp data functions
161
 */
162
sdp_data_t *sdp_data_alloc(uint8_t dtd, const void *value);
163
sdp_data_t *sdp_data_alloc_with_length(uint8_t dtd, const void *value, uint32_t length);
164
void sdp_data_free(sdp_data_t *data);
165
sdp_data_t *sdp_data_get(const sdp_record_t *rec, uint16_t attr_id);
166
167
sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len);
168
sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len);
169
sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data);
170
171
int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
172
void sdp_attr_remove(sdp_record_t *rec, uint16_t attr);
173
void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
174
int sdp_set_uuidseq_attr(sdp_record_t *rec, uint16_t attr, sdp_list_t *seq);
175
int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **seqp);
176
177
/*
178
 * NOTE that none of the functions below will update the SDP server,
179
 * unless the {register, update}sdp_record_t() function is invoked.
180
 * All functions which return an integer value, return 0 on success
181
 * or -1 on failure.
182
 */
183
184
/*
185
 * Create an attribute and add it to the service record's attribute list.
186
 * This consists of the data type descriptor of the attribute,
187
 * the value of the attribute and the attribute identifier.
188
 */
189
int sdp_attr_add_new(sdp_record_t *rec, uint16_t attr, uint8_t dtd, const void *p);
190
191
/*
192
 * Set the information attributes of the service record.
193
 * The set of attributes comprises service name, description
194
 * and provider name
195
 */
196
void sdp_set_info_attr(sdp_record_t *rec, const char *name, const char *prov, const char *desc);
197
198
/*
199
 * Set the ServiceClassID attribute to the sequence specified by seq.
200
 * Note that the identifiers need to be in sorted order from the most
201
 * specific to the most generic service class that this service
202
 * conforms to.
203
 */
204
static inline int sdp_set_service_classes(sdp_record_t *rec, sdp_list_t *seq)
205
0
{
206
0
  return sdp_set_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seq);
207
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_set_service_classes
Unexecuted instantiation: fuzz_xml.c:sdp_set_service_classes
Unexecuted instantiation: fuzz_hci.c:sdp_set_service_classes
208
209
/*
210
 * Get the service classes to which the service conforms.
211
 *
212
 * When set, the list contains elements of ServiceClassIdentifer(uint16_t)
213
 * ordered from most specific to most generic
214
 */
215
static inline int sdp_get_service_classes(const sdp_record_t *rec, sdp_list_t **seqp)
216
0
{
217
0
  return sdp_get_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seqp);
218
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_service_classes
Unexecuted instantiation: fuzz_xml.c:sdp_get_service_classes
Unexecuted instantiation: fuzz_hci.c:sdp_get_service_classes
219
220
/*
221
 * Set the BrowseGroupList attribute to the list specified by seq.
222
 *
223
 * A service can belong to one or more service groups
224
 * and the list comprises such group identifiers (UUIDs)
225
 */
226
static inline int sdp_set_browse_groups(sdp_record_t *rec, sdp_list_t *seq)
227
0
{
228
0
  return sdp_set_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seq);
229
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_set_browse_groups
Unexecuted instantiation: fuzz_xml.c:sdp_set_browse_groups
Unexecuted instantiation: fuzz_hci.c:sdp_set_browse_groups
230
231
/*
232
 * Set the access protocols of the record to those specified in proto
233
 */
234
int sdp_set_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
235
236
/*
237
 * Set the additional access protocols of the record to those specified in proto
238
 */
239
int sdp_set_add_access_protos(sdp_record_t *rec, const sdp_list_t *proto);
240
241
/*
242
 * Get protocol port (i.e. PSM for L2CAP, Channel for RFCOMM)
243
 */
244
int sdp_get_proto_port(const sdp_list_t *list, int proto);
245
246
/*
247
 * Get protocol descriptor.
248
 */
249
sdp_data_t *sdp_get_proto_desc(sdp_list_t *list, int proto);
250
251
/*
252
 * Set the LanguageBase attributes to the values specified in list
253
 * (a linked list of sdp_lang_attr_t objects, one for each language in
254
 * which user-visible attributes are present).
255
 */
256
int sdp_set_lang_attr(sdp_record_t *rec, const sdp_list_t *list);
257
258
/*
259
 * Set the ServiceInfoTimeToLive attribute of the service.
260
 * This is the number of seconds that this record is guaranteed
261
 * not to change after being obtained by a client.
262
 */
263
static inline int sdp_set_service_ttl(sdp_record_t *rec, uint32_t ttl)
264
0
{
265
0
  return sdp_attr_add_new(rec, SDP_ATTR_SVCINFO_TTL, SDP_UINT32, &ttl);
266
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_set_service_ttl
Unexecuted instantiation: fuzz_xml.c:sdp_set_service_ttl
Unexecuted instantiation: fuzz_hci.c:sdp_set_service_ttl
267
268
/*
269
 * Set the ServiceRecordState attribute of a service. This is
270
 * guaranteed to change if there is any kind of modification to
271
 * the record.
272
 */
273
static inline int sdp_set_record_state(sdp_record_t *rec, uint32_t state)
274
0
{
275
0
  return sdp_attr_add_new(rec, SDP_ATTR_RECORD_STATE, SDP_UINT32, &state);
276
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_set_record_state
Unexecuted instantiation: fuzz_xml.c:sdp_set_record_state
Unexecuted instantiation: fuzz_hci.c:sdp_set_record_state
277
278
/*
279
 * Set the ServiceID attribute of a service.
280
 */
281
void sdp_set_service_id(sdp_record_t *rec, uuid_t uuid);
282
283
/*
284
 * Set the GroupID attribute of a service
285
 */
286
void sdp_set_group_id(sdp_record_t *rec, uuid_t grouuuid);
287
288
/*
289
 * Set the ServiceAvailability attribute of a service.
290
 *
291
 * Note that this represents the relative availability
292
 * of the service: 0x00 means completely unavailable;
293
 * 0xFF means maximum availability.
294
 */
295
static inline int sdp_set_service_avail(sdp_record_t *rec, uint8_t avail)
296
0
{
297
0
  return sdp_attr_add_new(rec, SDP_ATTR_SERVICE_AVAILABILITY, SDP_UINT8, &avail);
298
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_set_service_avail
Unexecuted instantiation: fuzz_xml.c:sdp_set_service_avail
Unexecuted instantiation: fuzz_hci.c:sdp_set_service_avail
299
300
/*
301
 * Set the profile descriptor list attribute of a record.
302
 *
303
 * Each element in the list is an object of type
304
 * sdp_profile_desc_t which is a definition of the
305
 * Bluetooth profile that this service conforms to.
306
 */
307
int sdp_set_profile_descs(sdp_record_t *rec, const sdp_list_t *desc);
308
309
/*
310
 * Set URL attributes of a record.
311
 *
312
 * ClientExecutableURL: a URL to a client's platform specific (WinCE,
313
 * PalmOS) executable code that can be used to access this service.
314
 *
315
 * DocumentationURL: a URL pointing to service documentation
316
 *
317
 * IconURL: a URL to an icon that can be used to represent this service.
318
 *
319
 * Note: pass NULL for any URLs that you don't want to set or remove
320
 */
321
void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char *docURL, const char *iconURL);
322
323
/*
324
 * a service search request.
325
 *
326
 *  INPUT :
327
 *
328
 *    sdp_list_t *search
329
 *      list containing elements of the search
330
 *      pattern. Each entry in the list is a UUID
331
 *      of the service to be searched
332
 *
333
 *    uint16_t max_rec_num
334
 *       An integer specifying the maximum number of
335
 *       entries that the client can handle in the response.
336
 *
337
 *  OUTPUT :
338
 *
339
 *    int return value
340
 *      0
341
 *        The request completed successfully. This does not
342
 *        mean the requested services were found
343
 *      -1
344
 *        The request completed unsuccessfully
345
 *
346
 *    sdp_list_t *rsp_list
347
 *      This variable is set on a successful return if there are
348
 *      non-zero service handles. It is a singly linked list of
349
 *      service record handles (uint16_t)
350
 */
351
int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num, sdp_list_t **rsp_list);
352
353
/*
354
 *  a service attribute request.
355
 *
356
 *  INPUT :
357
 *
358
 *    uint32_t handle
359
 *      The handle of the service for which the attribute(s) are
360
 *      requested
361
 *
362
 *    sdp_attrreq_type_t reqtype
363
 *      Attribute identifiers are 16 bit unsigned integers specified
364
 *      in one of 2 ways described below :
365
 *      SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
366
 *         They are the actual attribute identifiers in ascending order
367
 *
368
 *      SDP_ATTR_REQ_RANGE - 32bit identifier range
369
 *         The high-order 16bits is the start of range
370
 *         the low-order 16bits are the end of range
371
 *         0x0000 to 0xFFFF gets all attributes
372
 *
373
 *    sdp_list_t *attrid_list
374
 *      Singly linked list containing attribute identifiers desired.
375
 *      Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
376
 *      or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
377
 *
378
 *  OUTPUT :
379
 *    int return value
380
 *      0
381
 *        The request completed successfully. This does not
382
 *        mean the requested services were found
383
 *      -1
384
 *        The request completed unsuccessfully due to a timeout
385
 */
386
sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list);
387
388
/*
389
 *  This is a service search request combined with the service
390
 *  attribute request. First a service class match is done and
391
 *  for matching service, requested attributes are extracted
392
 *
393
 *  INPUT :
394
 *
395
 *    sdp_list_t *search
396
 *      Singly linked list containing elements of the search
397
 *      pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16)
398
 *      of the service to be searched
399
 *
400
 *    AttributeSpecification attrSpec
401
 *      Attribute identifiers are 16 bit unsigned integers specified
402
 *      in one of 2 ways described below :
403
 *      SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers
404
 *         They are the actual attribute identifiers in ascending order
405
 *
406
 *      SDP_ATTR_REQ_RANGE - 32bit identifier range
407
 *         The high-order 16bits is the start of range
408
 *         the low-order 16bits are the end of range
409
 *         0x0000 to 0xFFFF gets all attributes
410
 *
411
 *    sdp_list_t *attrid_list
412
 *      Singly linked list containing attribute identifiers desired.
413
 *      Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL)
414
 *      or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE)
415
 *
416
 *  OUTPUT :
417
 *    int return value
418
 *      0
419
 *        The request completed successfully. This does not
420
 *        mean the requested services were found
421
 *      -1
422
 *        The request completed unsuccessfully due to a timeout
423
 *
424
 *    sdp_list_t *rsp_list
425
 *      This variable is set on a successful return to point to
426
 *      service(s) found. Each element of this list is of type
427
 *      sdp_record_t *.
428
 */
429
int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list, sdp_list_t **rsp_list);
430
431
/*
432
 * Allocate/free a service record and its attributes
433
 */
434
sdp_record_t *sdp_record_alloc(void);
435
void sdp_record_free(sdp_record_t *rec);
436
437
/*
438
 * Register a service record.
439
 *
440
 * Note: It is the responsbility of the Service Provider to create the
441
 * record first and set its attributes using setXXX() methods.
442
 *
443
 * The service provider must then call sdp_record_register() to make
444
 * the service record visible to SDP clients.  This function returns 0
445
 * on success or -1 on failure (and sets errno).
446
 */
447
int sdp_device_record_register_binary(sdp_session_t *session, bdaddr_t *device, uint8_t *data, uint32_t size, uint8_t flags, uint32_t *handle);
448
int sdp_device_record_register(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec, uint8_t flags);
449
int sdp_record_register(sdp_session_t *session, sdp_record_t *rec, uint8_t flags);
450
451
/*
452
 * Unregister a service record.
453
 */
454
int sdp_device_record_unregister_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle);
455
int sdp_device_record_unregister(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec);
456
int sdp_record_unregister(sdp_session_t *session, sdp_record_t *rec);
457
458
/*
459
 * Update an existing service record.  (Calling this function
460
 * before a previous call to sdp_record_register() will result
461
 * in an error.)
462
 */
463
int sdp_device_record_update_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle, uint8_t *data, uint32_t size);
464
int sdp_device_record_update(sdp_session_t *session, bdaddr_t *device, const sdp_record_t *rec);
465
int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec);
466
467
void sdp_record_print(const sdp_record_t *rec);
468
469
/*
470
 * UUID functions
471
 */
472
uuid_t *sdp_uuid16_create(uuid_t *uuid, uint16_t data);
473
uuid_t *sdp_uuid32_create(uuid_t *uuid, uint32_t data);
474
uuid_t *sdp_uuid128_create(uuid_t *uuid, const void *data);
475
int sdp_uuid16_cmp(const void *p1, const void *p2);
476
int sdp_uuid128_cmp(const void *p1, const void *p2);
477
int sdp_uuid_cmp(const void *p1, const void *p2);
478
uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid);
479
void sdp_uuid16_to_uuid128(uuid_t *uuid128, const uuid_t *uuid16);
480
void sdp_uuid32_to_uuid128(uuid_t *uuid128, const uuid_t *uuid32);
481
int sdp_uuid128_to_uuid(uuid_t *uuid);
482
int sdp_uuid_to_proto(uuid_t *uuid);
483
int sdp_uuid_extract(const uint8_t *buffer, int bufsize, uuid_t *uuid, int *scanned);
484
void sdp_uuid_print(const uuid_t *uuid);
485
486
#define MAX_LEN_UUID_STR 37
487
#define MAX_LEN_PROTOCOL_UUID_STR 8
488
#define MAX_LEN_SERVICECLASS_UUID_STR 28
489
#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28
490
491
int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n);
492
int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n);
493
int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n);
494
int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n);
495
496
/*
497
 * In all the sdp_get_XXX(handle, XXX *xxx) functions below,
498
 * the XXX * is set to point to the value, should it exist
499
 * and 0 is returned. If the value does not exist, -1 is
500
 * returned and errno set to ENODATA.
501
 *
502
 * In all the methods below, the memory management rules are
503
 * simple. Don't free anything! The pointer returned, in the
504
 * case of constructed types, is a pointer to the contents
505
 * of the sdp_record_t.
506
 */
507
508
/*
509
 * Get the access protocols from the service record
510
 */
511
int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
512
513
/*
514
 * Get the additional access protocols from the service record
515
 */
516
int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **protos);
517
518
/*
519
 * Extract the list of browse groups to which the service belongs.
520
 * When set, seqp contains elements of GroupID (uint16_t)
521
 */
522
static inline int sdp_get_browse_groups(const sdp_record_t *rec, sdp_list_t **seqp)
523
0
{
524
0
  return sdp_get_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seqp);
525
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_browse_groups
Unexecuted instantiation: fuzz_xml.c:sdp_get_browse_groups
Unexecuted instantiation: fuzz_hci.c:sdp_get_browse_groups
526
527
/*
528
 * Extract language attribute meta-data of the service record.
529
 * For each language in the service record, LangSeq has a struct of type
530
 * sdp_lang_attr_t.
531
 */
532
int sdp_get_lang_attr(const sdp_record_t *rec, sdp_list_t **langSeq);
533
534
/*
535
 * Extract the Bluetooth profile descriptor sequence from a record.
536
 * Each element in the list is of type sdp_profile_desc_t
537
 * which contains the UUID of the profile and its version number
538
 * (encoded as major and minor in the high-order 8bits
539
 * and low-order 8bits respectively of the uint16_t)
540
 */
541
int sdp_get_profile_descs(const sdp_record_t *rec, sdp_list_t **profDesc);
542
543
/*
544
 * Extract SDP server version numbers
545
 *
546
 * Note: that this is an attribute of the SDP server only and
547
 * contains a list of uint16_t each of which represent the
548
 * major and minor SDP version numbers supported by this server
549
 */
550
int sdp_get_server_ver(const sdp_record_t *rec, sdp_list_t **pVnumList);
551
552
int sdp_get_service_id(const sdp_record_t *rec, uuid_t *uuid);
553
int sdp_get_group_id(const sdp_record_t *rec, uuid_t *uuid);
554
int sdp_get_record_state(const sdp_record_t *rec, uint32_t *svcRecState);
555
int sdp_get_service_avail(const sdp_record_t *rec, uint8_t *svcAvail);
556
int sdp_get_service_ttl(const sdp_record_t *rec, uint32_t *svcTTLInfo);
557
int sdp_get_database_state(const sdp_record_t *rec, uint32_t *svcDBState);
558
559
static inline int sdp_get_service_name(const sdp_record_t *rec, char *str, int len)
560
0
{
561
0
  return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len);
562
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_service_name
Unexecuted instantiation: fuzz_xml.c:sdp_get_service_name
Unexecuted instantiation: fuzz_hci.c:sdp_get_service_name
563
564
static inline int sdp_get_service_desc(const sdp_record_t *rec, char *str, int len)
565
0
{
566
0
  return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len);
567
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_service_desc
Unexecuted instantiation: fuzz_xml.c:sdp_get_service_desc
Unexecuted instantiation: fuzz_hci.c:sdp_get_service_desc
568
569
static inline int sdp_get_provider_name(const sdp_record_t *rec, char *str, int len)
570
0
{
571
0
  return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len);
572
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_provider_name
Unexecuted instantiation: fuzz_xml.c:sdp_get_provider_name
Unexecuted instantiation: fuzz_hci.c:sdp_get_provider_name
573
574
static inline int sdp_get_doc_url(const sdp_record_t *rec, char *str, int len)
575
0
{
576
0
  return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len);
577
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_doc_url
Unexecuted instantiation: fuzz_xml.c:sdp_get_doc_url
Unexecuted instantiation: fuzz_hci.c:sdp_get_doc_url
578
579
static inline int sdp_get_clnt_exec_url(const sdp_record_t *rec, char *str, int len)
580
0
{
581
0
  return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len);
582
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_clnt_exec_url
Unexecuted instantiation: fuzz_xml.c:sdp_get_clnt_exec_url
Unexecuted instantiation: fuzz_hci.c:sdp_get_clnt_exec_url
583
584
static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len)
585
0
{
586
0
  return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len);
587
0
}
Unexecuted instantiation: fuzz_sdp.c:sdp_get_icon_url
Unexecuted instantiation: fuzz_xml.c:sdp_get_icon_url
Unexecuted instantiation: fuzz_hci.c:sdp_get_icon_url
588
589
/*
590
 * Set the supported features
591
 * sf should be a list of list with each feature data
592
 * Returns 0 on success -1 on fail
593
 */
594
int sdp_set_supp_feat(sdp_record_t *rec, const sdp_list_t *sf);
595
596
/*
597
 * Get the supported features
598
 * seqp is set to a list of list with each feature data
599
 * Returns 0 on success, if an error occurred -1 is returned and errno is set
600
 */
601
int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp);
602
603
sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int bufsize, int *scanned);
604
sdp_record_t *sdp_copy_record(sdp_record_t *rec);
605
606
void sdp_data_print(sdp_data_t *data);
607
void sdp_print_service_attr(sdp_list_t *alist);
608
609
int sdp_attrid_comp_func(const void *key1, const void *key2);
610
611
void sdp_set_seq_len(uint8_t *ptr, uint32_t length);
612
void sdp_set_attrid(sdp_buf_t *pdu, uint16_t id);
613
void sdp_append_to_pdu(sdp_buf_t *dst, sdp_data_t *d);
614
void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len);
615
616
int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data);
617
int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu);
618
619
int sdp_extract_seqtype(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size);
620
621
sdp_data_t *sdp_extract_attr(const uint8_t *pdata, int bufsize, int *extractedLength, sdp_record_t *rec);
622
623
void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid);
624
void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq);
625
626
int sdp_send_req_w4_rsp(sdp_session_t *session, uint8_t *req, uint8_t *rsp, uint32_t reqsize, uint32_t *rspsize);
627
628
void sdp_add_lang_attr(sdp_record_t *rec);
629
630
#ifdef __cplusplus
631
}
632
#endif
633
634
#endif /* __SDP_LIB_H */