From ca16ae22dd4542899a4a8c9a843fc6f7e72dbab4 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 31 Mar 2004 16:35:56 +0000 Subject: Add header files of the SDP library --- include/sdp_lib.h | 529 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 529 insertions(+) create mode 100644 include/sdp_lib.h (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h new file mode 100644 index 00000000..4306eb55 --- /dev/null +++ b/include/sdp_lib.h @@ -0,0 +1,529 @@ +/* + Service Discovery Protocol (SDP) + Copyright (C) 2002 Maxim Krasnyansky , Stephen Crane + + Based on original SDP implementation by Nokia Corporation. + Copyright (C) 2001,2002 Nokia Corporation. + Original author Guruprasad Krishnamurthy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation; + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM, + OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER + RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE + USE OR PERFORMANCE OF THIS SOFTWARE. + + ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, + TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. + */ + +/* + * $Id$ + */ + +#ifndef SDP_LIB_H +#define SDP_LIB_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SDP lists + */ +typedef void(*sdp_list_func_t)(void *, void *); +typedef void(*sdp_free_func_t)(void *); +typedef int (*sdp_comp_func_t)(const void *, const void *); + +sdp_list_t *sdp_list_append(sdp_list_t *list, void *d); +sdp_list_t *sdp_list_remove(sdp_list_t *list, void *d); +sdp_list_t *sdp_list_insert_sorted(sdp_list_t *list, void *data, sdp_comp_func_t f); +void sdp_list_free(sdp_list_t *list, sdp_free_func_t f); + +static inline int sdp_list_len(const sdp_list_t *list) +{ + int n = 0; + for (; list; list = list->next) + n++; + return n; +} + +static inline sdp_list_t *sdp_list_find(sdp_list_t *list, void *u, sdp_comp_func_t f) +{ + for (; list; list = list->next) + if (f(list->data, u) == 0) + return list; + return NULL; +} + +static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u) +{ + for (; list; list = list->next) + f(list->data, u); +} + +/* + * create an L2CAP connection to a Bluetooth device + * + * INPUT: + * + * bdaddr_t *src: + * Address of the local device to use to make the connection + * (or BDADDR_ANY) + * + * bdaddr_t *dst: + * Address of the SDP server device + */ +sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags); +int sdp_close(sdp_session_t *session); + +static inline int sdp_get_socket(const sdp_session_t *s) +{ + return s->sock; +} + +/* + * find all devices in the piconet + */ +int sdp_general_inquiry(inquiry_info *ii, int dev_num, int duration, uint8_t *found); + +/* flexible extraction of basic attributes - Jean II */ +int sdp_get_int_attr(const sdp_record_t *rec, uint16_t attr, int *value); +int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int valuelen); + +/* + * Basic sdp data functions + */ +sdp_data_t *sdp_data_alloc(uint8_t dtd, const void *value); +void sdp_data_free(sdp_data_t *data); +sdp_data_t *sdp_data_get(const sdp_record_t *rec, uint16_t attr_id); + +sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len); +sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data); + +int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data); +void sdp_attr_remove(sdp_record_t *rec, uint16_t attr); +void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data); +int sdp_set_uuidseq_attr(sdp_record_t *rec, uint16_t attr, sdp_list_t *seq); +int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **seqp); + +/* + * NOTE that none of the functions below will update the SDP server, + * unless the {register, update}sdp_record_t() function is invoked. + * All functions which return an integer value, return 0 on success + * or -1 on failure. + */ + +/* + * Create an attribute and add it to the service record's attribute list. + * This consists of the data type descriptor of the attribute, + * the value of the attribute and the attribute identifier. + */ +int sdp_attr_add_new(sdp_record_t *rec, uint16_t attr, uint8_t dtd, const void *p); + +/* + * Set the information attributes of the service record. + * The set of attributes comprises service name, description + * and provider name + */ +void sdp_set_info_attr(sdp_record_t *rec, const char *name, const char *prov, const char *desc); + +/* + * Set the ServiceClassID attribute to the sequence specified by seq. + * Note that the identifiers need to be in sorted order from the most + * specific to the most generic service class that this service + * conforms to. + */ +static inline int sdp_set_service_classes(sdp_record_t *rec, sdp_list_t *seq) +{ + return sdp_set_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seq); +} + +/* + * Get the service classes to which the service conforms. + * + * When set, the list contains elements of ServiceClassIdentifer(uint16_t) + * ordered from most specific to most generic + */ +static inline int sdp_get_service_classes(const sdp_record_t *rec, sdp_list_t **seqp) +{ + return sdp_get_uuidseq_attr(rec, SDP_ATTR_SVCLASS_ID_LIST, seqp); +} + +/* + * Set the BrowseGroupList attribute to the list specified by seq. + * + * A service can belong to one or more service groups + * and the list comprises such group identifiers (UUIDs) + */ +static inline int sdp_set_browse_groups(sdp_record_t *rec, sdp_list_t *seq) +{ + return sdp_set_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seq); +} + +/* + * Set the access protocols of the record to those specified in proto + */ +int sdp_set_access_protos(sdp_record_t *rec, const sdp_list_t *proto); + +/* + * Get protocol port (i.e. PSM for L2CAP, Channel for RFCOMM) + */ +int sdp_get_proto_port(const sdp_list_t *list, int proto); + +/* + * Get protocol descriptor. + */ +sdp_data_t *sdp_get_proto_desc(sdp_list_t *list, int proto); + +/* + * Set the LanguageBase attributes to the values specified in list + * (a linked list of sdp_lang_attr_t objects, one for each language in + * which user-visible attributes are present). + */ +int sdp_set_lang_attr(sdp_record_t *rec, const sdp_list_t *list); + +/* + * Set the ServiceInfoTimeToLive attribute of the service. + * This is the number of seconds that this record is guaranteed + * not to change after being obtained by a client. + */ +static inline int sdp_set_service_ttl(sdp_record_t *rec, uint32_t ttl) +{ + return sdp_attr_add_new(rec, SDP_ATTR_SVCINFO_TTL, SDP_UINT32, &ttl); +} + +/* + * Set the ServiceRecordState attribute of a service. This is + * guaranteed to change if there is any kind of modification to + * the record. + */ +static inline int sdp_set_record_state(sdp_record_t *rec, uint32_t state) +{ + return sdp_attr_add_new(rec, SDP_ATTR_RECORD_STATE, SDP_UINT32, &state); +} + +/* + * Set the ServiceID attribute of a service. + */ +void sdp_set_service_id(sdp_record_t *rec, uuid_t uuid); + +/* + * Set the GroupID attribute of a service + */ +void sdp_set_group_id(sdp_record_t *rec, uuid_t grouuuid); + +/* + * Set the ServiceAvailability attribute of a service. + * + * Note that this represents the relative availability + * of the service: 0x00 means completely unavailable; + * 0xFF means maximum availability. + */ +static inline int sdp_set_service_avail(sdp_record_t *rec, uint8_t avail) +{ + return sdp_attr_add_new(rec, SDP_ATTR_SERVICE_AVAILABILITY, SDP_UINT8, &avail); +} + +/* + * Set the profile descriptor list attribute of a record. + * + * Each element in the list is an object of type + * sdp_profile_desc_t which is a definition of the + * Bluetooth profile that this service conforms to. + */ +int sdp_set_profile_descs(sdp_record_t *rec, const sdp_list_t *desc); + +/* + * Set URL attributes of a record. + * + * ClientExecutableURL: a URL to a client's platform specific (WinCE, + * PalmOS) executable code that can be used to access this service. + * + * DocumentationURL: a URL pointing to service documentation + * + * IconURL: a URL to an icon that can be used to represent this service. + * + * Note: pass NULL for any URLs that you don't want to set or remove + */ +void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char *docURL, const char *iconURL); + +/* + * a service search request. + * + * INPUT : + * + * sdp_list_t *search_list + * list containing elements of the search + * pattern. Each entry in the list is a UUID + * of the service to be searched + * + * uint16_t max_rec_num + * An integer specifying the maximum number of + * entries that the client can handle in the response. + * + * OUTPUT : + * + * int return value + * 0 + * The request completed successfully. This does not + * mean the requested services were found + * -1 + * The request completed unsuccessfully + * + * sdp_list_t *rsp_list + * This variable is set on a successful return if there are + * non-zero service handles. It is a singly linked list of + * service records (sdp_record_t) + */ +int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num, sdp_list_t **rsp_list); + +/* + * a service attribute request. + * + * INPUT : + * + * uint32_t handle + * The handle of the service for which the attribute(s) are + * requested + * + * sdp_attrreq_type_t reqtype + * Attribute identifiers are 16 bit unsigned integers specified + * in one of 2 ways described below : + * SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers + * They are the actual attribute identifiers in ascending order + * + * SDP_ATTR_REQ_RANGE - 32bit identifier range + * The high-order 16bits is the start of range + * the low-order 16bits are the end of range + * 0x0000 to 0xFFFF gets all attributes + * + * sdp_list_t *attrid_list + * Singly linked list containing attribute identifiers desired. + * Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL) + * or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE) + * + * OUTPUT : + * int return value + * 0 + * The request completed successfully. This does not + * mean the requested services were found + * -1 + * The request completed unsuccessfully due to a timeout + */ + +typedef enum { + /* + * Attributes are specified as individual elements + */ + SDP_ATTR_REQ_INDIVIDUAL = 1, + /* + * Attributes are specified as a range + */ + SDP_ATTR_REQ_RANGE +} sdp_attrreq_type_t; + +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); + +/* + * This is a service search request combined with the service + * attribute request. First a service class match is done and + * for matching service, requested attributes are extracted + * + * INPUT : + * + * sdp_list_t *search_list + * Singly linked list containing elements of the search + * pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16) + * of the service to be searched + * + * AttributeSpecification attrSpec + * Attribute identifiers are 16 bit unsigned integers specified + * in one of 2 ways described below : + * SDP_ATTR_REQ_INDIVIDUAL - 16bit individual identifiers + * They are the actual attribute identifiers in ascending order + * + * SDP_ATTR_REQ_RANGE - 32bit identifier range + * The high-order 16bits is the start of range + * the low-order 16bits are the end of range + * 0x0000 to 0xFFFF gets all attributes + * + * sdp_list_t *attrid_list + * Singly linked list containing attribute identifiers desired. + * Every element is either a uint16_t(attrSpec = SDP_ATTR_REQ_INDIVIDUAL) + * or a uint32_t(attrSpec=SDP_ATTR_REQ_RANGE) + * + * OUTPUT : + * int return value + * 0 + * The request completed successfully. This does not + * mean the requested services were found + * -1 + * The request completed unsuccessfully due to a timeout + * + * sdp_list_t *rsp_list + * This variable is set on a successful return to point to + * service(s) found. Each element of this list is of type + * sdp_record_t *. + */ +int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list, sdp_list_t **rsp_list); + +/* + * Allocate/free a service record and its attributes + */ +sdp_record_t *sdp_record_alloc(void); +void sdp_record_free(sdp_record_t *rec); + +/* + * Register a service record. + * + * Note: It is the responsbility of the Service Provider to create the + * record first and set its attributes using setXXX() methods. + * + * The service provider must then call sdp_record_register() to make + * the service record visible to SDP clients. + */ +int sdp_record_register(sdp_session_t *sess, sdp_record_t *rec, uint8_t flags); + +/* + * Unregister a service record. + */ +int sdp_record_unregister(sdp_session_t *sess, sdp_record_t *rec); + +/* + * Update an existing service record. (Calling this function + * before a previous call to sdp_record_register() will result + * in an error.) + */ +int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec); + +void sdp_record_print(const sdp_record_t *rec); + +/* + * UUID functions + */ +uuid_t *sdp_uuid16_create(uuid_t *uuid, uint16_t data); +uuid_t *sdp_uuid32_create(uuid_t *uuid, uint32_t data); +uuid_t *sdp_uuid128_create(uuid_t *uuid, const void *data); +int sdp_uuid16_cmp(const void *p1, const void *p2); +int sdp_uuid128_cmp(const void *p1, const void *p2); +uuid_t *sdp_uuid_to_uuid128(uuid_t *uuid); +void sdp_uuid16_to_uuid128(uuid_t *uuid128, uuid_t *uuid16); +int sdp_uuid128_to_uuid(uuid_t *uuid); +int sdp_uuid_to_proto(uuid_t *uuid); +int sdp_uuid_extract(const char *buffer, uuid_t *uuid, int *scanned); +void sdp_uuid_print(const uuid_t *uuid); + +#define MAX_LEN_UUID_STR 37 +#define MAX_LEN_PROTOCOL_UUID_STR 8 +#define MAX_LEN_SERVICECLASS_UUID_STR 24 +#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 22 + +int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n); +int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n); +int sdp_svclass_uuid2strn(const uuid_t *uuid, char *str, size_t n); +int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n); + +/* + * In all the sdp_get_XXX(handle, XXX *xxx) functions below, + * the XXX * is set to point to the value, should it exist + * and 0 is returned. If the value does not exist, -1 is + * returned and errno set to ENODATA. + * + * In all the methods below, the memory management rules are + * simple. Don't free anything! The pointer returned, in the + * case of constructed types, is a pointer to the contents + * of the sdp_record_t. + */ + +/* + * Get the access protocols from the service record + */ +int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos); + +/* + * Extract the list of browse groups to which the service belongs. + * When set, seqp contains elements of GroupID (uint16_t) + */ +static inline int sdp_get_browse_groups(const sdp_record_t *rec, sdp_list_t **seqp) +{ + return sdp_get_uuidseq_attr(rec, SDP_ATTR_BROWSE_GRP_LIST, seqp); +} + +/* + * Extract language attribute meta-data of the service record. + * For each language in the service record, LangSeq has a struct of type + * sdp_lang_attr_t. + */ +int sdp_get_lang_attr(const sdp_record_t *rec, sdp_list_t **langSeq); + +/* + * Extract the Bluetooth profile descriptor sequence from a record. + * Each element in the list is of type sdp_profile_desc_t + * which contains the UUID of the profile and its version number + * (encoded as major and minor in the high-order 8bits + * and low-order 8bits respectively of the uint16_t) + */ +int sdp_get_profile_descs(const sdp_record_t *rec, sdp_list_t **profDesc); + +/* + * Extract SDP server version numbers + * + * Note: that this is an attribute of the SDP server only and + * contains a list of uint16_t each of which represent the + * major and minor SDP version numbers supported by this server + */ +int sdp_get_server_ver(const sdp_record_t *rec, sdp_list_t **pVnumList); + +int sdp_get_service_id(const sdp_record_t *rec, uuid_t *uuid); +int sdp_get_group_id(const sdp_record_t *rec, uuid_t *uuid); +int sdp_get_record_state(const sdp_record_t *rec, uint32_t *svcRecState); +int sdp_get_service_avail(const sdp_record_t *rec, uint8_t *svcAvail); +int sdp_get_service_ttl(const sdp_record_t *rec, uint32_t *svcTTLInfo); +int sdp_get_database_state(const sdp_record_t *rec, uint32_t *svcDBState); + +static inline int sdp_get_service_name(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len); +} + +static inline int sdp_get_service_desc(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len); +} + +static inline int sdp_get_provider_name(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len); +} + +static inline int sdp_get_doc_url(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len); +} + +static inline int sdp_get_clnt_exec_url(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len); +} + +static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) +{ + return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); +} + +#ifdef __cplusplus +} +#endif + +#endif -- cgit From 99c36169b28df63153d24d1824bd276e68f5f140 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 1 Apr 2004 14:01:15 +0000 Subject: Increase size of UUID string representation --- include/sdp_lib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 4306eb55..763f80fa 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -426,8 +426,8 @@ void sdp_uuid_print(const uuid_t *uuid); #define MAX_LEN_UUID_STR 37 #define MAX_LEN_PROTOCOL_UUID_STR 8 -#define MAX_LEN_SERVICECLASS_UUID_STR 24 -#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 22 +#define MAX_LEN_SERVICECLASS_UUID_STR 28 +#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28 int sdp_uuid2strn(const uuid_t *uuid, char *str, size_t n); int sdp_proto_uuid2strn(const uuid_t *uuid, char *str, size_t n); -- cgit From 764abe23a0d4ede999f1f34ee0e310c0eeaaff79 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Apr 2004 05:11:38 +0000 Subject: Update copyright information --- include/sdp_lib.h | 76 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 37 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 763f80fa..d2753912 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -1,34 +1,36 @@ /* - Service Discovery Protocol (SDP) - Copyright (C) 2002 Maxim Krasnyansky , Stephen Crane - - Based on original SDP implementation by Nokia Corporation. - Copyright (C) 2001,2002 Nokia Corporation. - Original author Guruprasad Krishnamurthy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation; - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY CLAIM, - OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER - RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE - USE OR PERFORMANCE OF THIS SOFTWARE. - - ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, COPYRIGHTS, - TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS SOFTWARE IS DISCLAIMED. - */ - -/* - * $Id$ - */ - -#ifndef SDP_LIB_H -#define SDP_LIB_H + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2001-2002 Nokia Corporation + * Copyright (C) 2002-2003 Maxim Krasnyansky + * Copyright (C) 2002-2004 Marcel Holtmann + * Copyright (C) 2002-2003 Stephen Crane + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. + * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY + * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, + * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS + * SOFTWARE IS DISCLAIMED. + * + * + * $Id$ + */ + +#ifndef __SDP_LIB_H +#define __SDP_LIB_H #include #include @@ -494,36 +496,36 @@ int sdp_get_database_state(const sdp_record_t *rec, uint32_t *svcDBState); static inline int sdp_get_service_name(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_SVCNAME_PRIMARY, str, len); } static inline int sdp_get_service_desc(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_SVCDESC_PRIMARY, str, len); } static inline int sdp_get_provider_name(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_PROVNAME_PRIMARY, str, len); } static inline int sdp_get_doc_url(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_DOC_URL, str, len); } static inline int sdp_get_clnt_exec_url(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_CLNT_EXEC_URL, str, len); } static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) { - return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); + return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); } #ifdef __cplusplus } #endif -#endif +#endif /* __SDP_LIB_H */ -- cgit From 4f6e2df58332458dd32f62fe452a99114c7d85d0 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Apr 2004 09:21:06 +0000 Subject: Move some internal functions to public --- include/sdp_lib.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index d2753912..715f98cf 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -524,6 +524,44 @@ static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); } +/* + * Generate unique transaction identifiers + */ +static inline uint16_t sdp_gen_tid(sdp_session_t *session) +{ + return session->tid++; +} + +sdp_record_t *sdp_extract_pdu(const char *pdata, int *scanned); +sdp_data_t *sdp_extract_string(char *, int *); + +void sdp_data_print(sdp_data_t *data); +void sdp_print_service_attr(sdp_list_t *alist); + +int sdp_attrid_comp_func(const void *key1, const void *key2); + +void sdp_set_seq_len(char *ptr, int length); +void sdp_set_attrid(sdp_buf_t *pdu, uint16_t id); +void sdp_append_to_pdu(sdp_buf_t *dst, sdp_data_t *d); +void sdp_append_to_buf(sdp_buf_t *dst, char *data, int len); + +int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data); +int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu); + +int sdp_extract_seqtype(const char *buf, uint8_t *dtdp, int *seqlen); + +sdp_data_t *sdp_extract_attr(const char *pdata, int *extractedLength, sdp_record_t *rec); + +void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid); +void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq); + +int sdp_send_req_w4_rsp(sdp_session_t *session, char *req, char *rsp, int reqsize, int *rspsize); + +typedef struct { + uint8_t length; + unsigned char data[16]; +} __attribute__ ((packed)) sdp_cstate_t; + #ifdef __cplusplus } #endif -- cgit From 233bd39dee08afc5176b203e6348184da56d7bff Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 2 May 2004 21:40:30 +0000 Subject: Add sdp_get_add_access_protos() function --- include/sdp_lib.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 715f98cf..0fa7cb7a 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -453,6 +453,11 @@ int sdp_profile_uuid2strn(const uuid_t *uuid, char *str, size_t n); */ int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos); +/* + * Get the additional access protocols from the service record + */ +int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **pap); + /* * Extract the list of browse groups to which the service belongs. * When set, seqp contains elements of GroupID (uint16_t) -- cgit From f1d23ac858b0593afe27e6b8e00a55d92804a6bb Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Jan 2005 03:08:19 +0000 Subject: Update the copyright year --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 0fa7cb7a..53c74d3f 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -4,7 +4,7 @@ * * Copyright (C) 2001-2002 Nokia Corporation * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2004 Marcel Holtmann + * Copyright (C) 2002-2005 Marcel Holtmann * Copyright (C) 2002-2003 Stephen Crane * * -- cgit From 28b4f0aea5b15ed7c0acd17ab79705a38ffe7c2f Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Mon, 28 Feb 2005 12:19:25 +0000 Subject: fix incorrect doc comment --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 53c74d3f..6a5d7d82 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -286,7 +286,7 @@ void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char * * sdp_list_t *rsp_list * This variable is set on a successful return if there are * non-zero service handles. It is a singly linked list of - * service records (sdp_record_t) + * service record handles (uint16_t) */ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num, sdp_list_t **rsp_list); -- cgit From 8b11908eac4e0b4e14534ec2d44ae62806fdfd2f Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Wed, 2 Mar 2005 10:23:16 +0000 Subject: fix comments --- include/sdp_lib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 6a5d7d82..7661d24e 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -393,7 +393,8 @@ void sdp_record_free(sdp_record_t *rec); * record first and set its attributes using setXXX() methods. * * The service provider must then call sdp_record_register() to make - * the service record visible to SDP clients. + * the service record visible to SDP clients. This function returns 0 + * on success or -1 on failure (and sets errno). */ int sdp_record_register(sdp_session_t *sess, sdp_record_t *rec, uint8_t flags); -- cgit From cfa3a02e2593bd72ce4a83f521e1e89a5874ea7d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 6 Jul 2005 00:12:25 +0000 Subject: Fix more GCC 4.0 warnings --- include/sdp_lib.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 7661d24e..b4e83fe3 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -424,7 +424,7 @@ uuid_t *sdp_uuid_to_uuid128(uuid_t *uuid); void sdp_uuid16_to_uuid128(uuid_t *uuid128, uuid_t *uuid16); int sdp_uuid128_to_uuid(uuid_t *uuid); int sdp_uuid_to_proto(uuid_t *uuid); -int sdp_uuid_extract(const char *buffer, uuid_t *uuid, int *scanned); +int sdp_uuid_extract(const uint8_t *buffer, uuid_t *uuid, int *scanned); void sdp_uuid_print(const uuid_t *uuid); #define MAX_LEN_UUID_STR 37 @@ -538,30 +538,30 @@ static inline uint16_t sdp_gen_tid(sdp_session_t *session) return session->tid++; } -sdp_record_t *sdp_extract_pdu(const char *pdata, int *scanned); -sdp_data_t *sdp_extract_string(char *, int *); +sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int *scanned); +sdp_data_t *sdp_extract_string(uint8_t *, int *); void sdp_data_print(sdp_data_t *data); void sdp_print_service_attr(sdp_list_t *alist); int sdp_attrid_comp_func(const void *key1, const void *key2); -void sdp_set_seq_len(char *ptr, int length); +void sdp_set_seq_len(uint8_t *ptr, uint32_t length); void sdp_set_attrid(sdp_buf_t *pdu, uint16_t id); void sdp_append_to_pdu(sdp_buf_t *dst, sdp_data_t *d); -void sdp_append_to_buf(sdp_buf_t *dst, char *data, int len); +void sdp_append_to_buf(sdp_buf_t *dst, uint8_t *data, uint32_t len); int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data); int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu); -int sdp_extract_seqtype(const char *buf, uint8_t *dtdp, int *seqlen); +int sdp_extract_seqtype(const uint8_t *buf, uint8_t *dtdp, int *seqlen); -sdp_data_t *sdp_extract_attr(const char *pdata, int *extractedLength, sdp_record_t *rec); +sdp_data_t *sdp_extract_attr(const uint8_t *pdata, int *extractedLength, sdp_record_t *rec); void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid); void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq); -int sdp_send_req_w4_rsp(sdp_session_t *session, char *req, char *rsp, int reqsize, int *rspsize); +int sdp_send_req_w4_rsp(sdp_session_t *session, uint8_t *req, uint8_t *rsp, uint32_t reqsize, uint32_t *rspsize); typedef struct { uint8_t length; -- cgit From a1454c0f12421da1849ca347f8a30d084778d679 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 3 Aug 2005 07:18:31 +0000 Subject: Create per device SDP server functions --- include/sdp_lib.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index b4e83fe3..b9fbf6f3 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -397,11 +397,13 @@ void sdp_record_free(sdp_record_t *rec); * on success or -1 on failure (and sets errno). */ int sdp_record_register(sdp_session_t *sess, sdp_record_t *rec, uint8_t flags); +int sdp_device_record_register(sdp_session_t *sess, bdaddr_t *device, sdp_record_t *rec, uint8_t flags); /* * Unregister a service record. */ int sdp_record_unregister(sdp_session_t *sess, sdp_record_t *rec); +int sdp_device_record_unregister(sdp_session_t *sess, bdaddr_t *device, sdp_record_t *rec); /* * Update an existing service record. (Calling this function @@ -409,6 +411,7 @@ int sdp_record_unregister(sdp_session_t *sess, sdp_record_t *rec); * in an error.) */ int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec); +int sdp_device_record_update(sdp_session_t *sess, bdaddr_t *device, const sdp_record_t *rec); void sdp_record_print(const sdp_record_t *rec); -- cgit From c0d524486a50e8366c12c5ebea1a4441e9db46aa Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 29 Oct 2005 19:25:42 +0000 Subject: Big cleanup of CVS relics --- include/sdp_lib.h | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index b9fbf6f3..57b5b15f 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -9,24 +9,19 @@ * * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation; + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. - * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY - * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, - * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS - * SOFTWARE IS DISCLAIMED. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * - * $Id$ */ #ifndef __SDP_LIB_H -- cgit From 641d636fb24fb0dea567388a4f0d0f135d4ea48c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 9 Dec 2005 09:12:44 +0000 Subject: Add support for allocation of binary text elements --- include/sdp_lib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 57b5b15f..a45f36ef 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -102,10 +102,12 @@ int sdp_get_string_attr(const sdp_record_t *rec, uint16_t attr, char *value, int * Basic sdp data functions */ sdp_data_t *sdp_data_alloc(uint8_t dtd, const void *value); +sdp_data_t *sdp_data_alloc_with_length(uint8_t dtd, const void *value, uint32_t length); void sdp_data_free(sdp_data_t *data); sdp_data_t *sdp_data_get(const sdp_record_t *rec, uint16_t attr_id); sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len); +sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len); sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data); int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data); -- cgit From aa8d087a052ab9c54dde1b0ddaf3a47494ef899a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 14 Dec 2005 10:11:26 +0000 Subject: Add support for additional access protocols --- include/sdp_lib.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index a45f36ef..7f22451e 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -175,6 +175,11 @@ static inline int sdp_set_browse_groups(sdp_record_t *rec, sdp_list_t *seq) */ int sdp_set_access_protos(sdp_record_t *rec, const sdp_list_t *proto); +/* + * Set the additional access protocols of the record to those specified in proto + */ +int sdp_set_add_access_protos(sdp_record_t *rec, const sdp_list_t *proto); + /* * Get protocol port (i.e. PSM for L2CAP, Channel for RFCOMM) */ @@ -457,7 +462,7 @@ int sdp_get_access_protos(const sdp_record_t *rec, sdp_list_t **protos); /* * Get the additional access protocols from the service record */ -int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **pap); +int sdp_get_add_access_protos(const sdp_record_t *rec, sdp_list_t **protos); /* * Extract the list of browse groups to which the service belongs. -- cgit From 197a2aee34d9a1643cd474f8f167552ca6395d01 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 3 Jan 2006 12:56:09 +0000 Subject: Update copyright information --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 7f22451e..dc074c6a 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -4,7 +4,7 @@ * * Copyright (C) 2001-2002 Nokia Corporation * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2005 Marcel Holtmann + * Copyright (C) 2002-2006 Marcel Holtmann * Copyright (C) 2002-2003 Stephen Crane * * -- cgit From 8f6ea7c3d24dc21f120b6d29fc975936b4d4f3b7 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 17 Aug 2006 21:59:25 +0000 Subject: Add additional private data field --- include/sdp_lib.h | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index dc074c6a..8a89ab6e 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -69,6 +69,30 @@ static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u f(list->data, u); } +/* + * Values of the flags parameter to sdp_record_register + */ +#define SDP_RECORD_PERSIST 0x01 +#define SDP_DEVICE_RECORD 0x02 + +/* + * Values of the flags parameter to sdp_connect + */ +#define SDP_RETRY_IF_BUSY 0x01 +#define SDP_WAIT_ON_CLOSE 0x02 + +/* + * a session with an SDP server + */ +typedef struct { + int sock; + int state; + int local; + int flags; + uint16_t tid; // Current transaction ID + void *priv; +} sdp_session_t; + /* * create an L2CAP connection to a Bluetooth device * @@ -83,11 +107,9 @@ static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u */ sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t flags); int sdp_close(sdp_session_t *session); +int sdp_get_socket(const sdp_session_t *session); -static inline int sdp_get_socket(const sdp_session_t *s) -{ - return s->sock; -} +uint16_t sdp_gen_tid(sdp_session_t *session); /* * find all devices in the piconet @@ -535,14 +557,6 @@ static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); } -/* - * Generate unique transaction identifiers - */ -static inline uint16_t sdp_gen_tid(sdp_session_t *session) -{ - return session->tid++; -} - sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int *scanned); sdp_data_t *sdp_extract_string(uint8_t *, int *); -- cgit From 8be090b298a02108146d3bf48271f8408ac31917 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Fri, 25 Aug 2006 19:12:38 +0000 Subject: Added sdp_create for async searches --- include/sdp_lib.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 8a89ab6e..a4b2cb4b 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -111,6 +111,12 @@ int sdp_get_socket(const sdp_session_t *session); uint16_t sdp_gen_tid(sdp_session_t *session); +/* + * SDP transaction: functions for asynchronous search. + */ +typedef void sdp_callback_t(uint8_t type, sdp_list_t *rsp, void *udata, int err); +sdp_session_t *sdp_create(int sk, uint32_t flags); + /* * find all devices in the piconet */ -- cgit From dd610a12694a42aeb67417c95d87384f2eef8e70 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 25 Aug 2006 22:22:01 +0000 Subject: Add sdp_set_notify function --- include/sdp_lib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index a4b2cb4b..eaf4cdb0 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -114,8 +114,9 @@ uint16_t sdp_gen_tid(sdp_session_t *session); /* * SDP transaction: functions for asynchronous search. */ -typedef void sdp_callback_t(uint8_t type, sdp_list_t *rsp, void *udata, int err); +typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t *size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); +int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); /* * find all devices in the piconet -- cgit From f9264e21a9e0c97e6a4d970c0b31cf01fc18781d Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 28 Aug 2006 19:49:18 +0000 Subject: Added sdp_process and sdp_service_search_async functions --- include/sdp_lib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index eaf4cdb0..64fe5b52 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -114,9 +114,11 @@ uint16_t sdp_gen_tid(sdp_session_t *session); /* * SDP transaction: functions for asynchronous search. */ -typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t *size, void *udata); +typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); +int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search); +int sdp_process(sdp_session_t *session); /* * find all devices in the piconet -- cgit From 343f72ba28deaf9ddc68043567baad76e0325e5d Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 28 Aug 2006 21:26:50 +0000 Subject: Added SDP error response parsing --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 64fe5b52..23157c6f 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -114,7 +114,7 @@ uint16_t sdp_gen_tid(sdp_session_t *session); /* * SDP transaction: functions for asynchronous search. */ -typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); +typedef void sdp_callback_t(uint8_t type, int status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search); -- cgit From c8e5a1464ff8edb068e7361a257ef4ae34674cf8 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Tue, 29 Aug 2006 16:29:00 +0000 Subject: changed error handling in sdp_process function --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 23157c6f..64fe5b52 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -114,7 +114,7 @@ uint16_t sdp_gen_tid(sdp_session_t *session); /* * SDP transaction: functions for asynchronous search. */ -typedef void sdp_callback_t(uint8_t type, int status, uint8_t *rsp, size_t size, void *udata); +typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search); -- cgit From 453a0cedb6c909047553ffc7145bcef26a3ae94c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 29 Aug 2006 21:39:07 +0000 Subject: Correct prototypes for async functions --- include/sdp_lib.h | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 64fe5b52..b1f839bc 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -111,13 +111,26 @@ int sdp_get_socket(const sdp_session_t *session); uint16_t sdp_gen_tid(sdp_session_t *session); +typedef enum { + /* + * Attributes are specified as individual elements + */ + SDP_ATTR_REQ_INDIVIDUAL = 1, + /* + * Attributes are specified as a range + */ + SDP_ATTR_REQ_RANGE +} sdp_attrreq_type_t; /* * SDP transaction: functions for asynchronous search. */ typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); -int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search); +int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num); +int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); +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); +int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); int sdp_process(sdp_session_t *session); /* @@ -356,18 +369,6 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search_list * -1 * The request completed unsuccessfully due to a timeout */ - -typedef enum { - /* - * Attributes are specified as individual elements - */ - SDP_ATTR_REQ_INDIVIDUAL = 1, - /* - * Attributes are specified as a range - */ - SDP_ATTR_REQ_RANGE -} sdp_attrreq_type_t; - 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); /* -- cgit From 41064d605ba2f88f967c8388c9b20b92a7868a87 Mon Sep 17 00:00:00 2001 From: Ulisses Furquim Date: Wed, 30 Aug 2006 22:44:49 +0000 Subject: fix prototypes for sdp sync/async functions --- include/sdp_lib.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index b1f839bc..d61413c3 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -127,10 +127,9 @@ typedef enum { typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); -int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num); +int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num); int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); 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); -int sdp_service_search_attr_async(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); int sdp_process(sdp_session_t *session); /* @@ -311,7 +310,7 @@ void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char * * * INPUT : * - * sdp_list_t *search_list + * sdp_list_t *search * list containing elements of the search * pattern. Each entry in the list is a UUID * of the service to be searched @@ -334,7 +333,7 @@ void sdp_set_url_attr(sdp_record_t *rec, const char *clientExecURL, const char * * non-zero service handles. It is a singly linked list of * service record handles (uint16_t) */ -int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search_list, uint16_t max_rec_num, sdp_list_t **rsp_list); +int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num, sdp_list_t **rsp_list); /* * a service attribute request. @@ -378,7 +377,7 @@ sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_ * * INPUT : * - * sdp_list_t *search_list + * sdp_list_t *search * Singly linked list containing elements of the search * pattern. Each entry in the list is a UUID(DataTypeSDP_UUID16) * of the service to be searched @@ -412,7 +411,7 @@ sdp_record_t *sdp_service_attr_req(sdp_session_t *session, uint32_t handle, sdp_ * service(s) found. Each element of this list is of type * sdp_record_t *. */ -int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search_list, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list, sdp_list_t **rsp_list); +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); /* * Allocate/free a service record and its attributes -- cgit From 1be1f79648ba7aafde6349cfe51f9c929e20d018 Mon Sep 17 00:00:00 2001 From: Ulisses Furquim Date: Mon, 4 Sep 2006 17:13:33 +0000 Subject: Make sdp_connect() fully async aware --- include/sdp_lib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index d61413c3..0e8948f9 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -80,6 +80,7 @@ static inline void sdp_list_foreach(sdp_list_t *list, sdp_list_func_t f, void *u */ #define SDP_RETRY_IF_BUSY 0x01 #define SDP_WAIT_ON_CLOSE 0x02 +#define SDP_NON_BLOCKING 0x04 /* * a session with an SDP server @@ -125,6 +126,7 @@ typedef enum { * SDP transaction: functions for asynchronous search. */ typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); +int sdp_is_connected(sdp_session_t *session); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num); -- cgit From aa7577018bb1faac4b67b52dc8b003663cdd03ad Mon Sep 17 00:00:00 2001 From: Ulisses Furquim Date: Mon, 4 Sep 2006 21:10:23 +0000 Subject: Remove connected flag from SDP transaction structure --- include/sdp_lib.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 0e8948f9..dbc836b2 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -126,7 +126,6 @@ typedef enum { * SDP transaction: functions for asynchronous search. */ typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); -int sdp_is_connected(sdp_session_t *session); sdp_session_t *sdp_create(int sk, uint32_t flags); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num); -- cgit From 113a53acaec2519108f0cab944687b7abc537e74 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 5 Sep 2006 09:41:50 +0000 Subject: Remove sdp_cstate_t from the header file --- include/sdp_lib.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index dbc836b2..34082579 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -592,11 +592,6 @@ void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq); int sdp_send_req_w4_rsp(sdp_session_t *session, uint8_t *req, uint8_t *rsp, uint32_t reqsize, uint32_t *rspsize); -typedef struct { - uint8_t length; - unsigned char data[16]; -} __attribute__ ((packed)) sdp_cstate_t; - #ifdef __cplusplus } #endif -- cgit From 8bbf32450b3c72f5e8457feb825da029f3ecc76e Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 5 Sep 2006 09:44:32 +0000 Subject: Small code cleanup --- include/sdp_lib.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 34082579..343493b1 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -94,6 +94,19 @@ typedef struct { void *priv; } sdp_session_t; +typedef enum { + /* + * Attributes are specified as individual elements + */ + SDP_ATTR_REQ_INDIVIDUAL = 1, + /* + * Attributes are specified as a range + */ + SDP_ATTR_REQ_RANGE +} sdp_attrreq_type_t; + +typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); + /* * create an L2CAP connection to a Bluetooth device * @@ -110,28 +123,18 @@ sdp_session_t *sdp_connect(const bdaddr_t *src, const bdaddr_t *dst, uint32_t fl int sdp_close(sdp_session_t *session); int sdp_get_socket(const sdp_session_t *session); -uint16_t sdp_gen_tid(sdp_session_t *session); - -typedef enum { - /* - * Attributes are specified as individual elements - */ - SDP_ATTR_REQ_INDIVIDUAL = 1, - /* - * Attributes are specified as a range - */ - SDP_ATTR_REQ_RANGE -} sdp_attrreq_type_t; /* * SDP transaction: functions for asynchronous search. */ -typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); sdp_session_t *sdp_create(int sk, uint32_t flags); +int sdp_process(sdp_session_t *session); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); + int sdp_service_search_async(sdp_session_t *session, const sdp_list_t *search, uint16_t max_rec_num); int sdp_service_attr_async(sdp_session_t *session, uint32_t handle, sdp_attrreq_type_t reqtype, const sdp_list_t *attrid_list); 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); -int sdp_process(sdp_session_t *session); + +uint16_t sdp_gen_tid(sdp_session_t *session); /* * find all devices in the piconet -- cgit From 5ec20cab698055029198b10afb4db20bee06ce72 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Mon, 11 Sep 2006 20:55:05 +0000 Subject: fixed error handling in sdp_process( ) --- include/sdp_lib.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 343493b1..9a83586f 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -105,6 +105,15 @@ typedef enum { SDP_ATTR_REQ_RANGE } sdp_attrreq_type_t; +/* + * When the pdu_id(type) is a sdp error response, check the status value + * to figure out the error reason. For status values 0x0001-0x0006 check + * Bluetooth SPEC. If the status is 0xffff, call sdp_get_error function + * to get the real reason: + * - wrong transaction ID(EPROTO) + * - wrong PDU id or(EPROTO) + * - I/O error + */ typedef void sdp_callback_t(uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *udata); /* @@ -127,6 +136,7 @@ int sdp_get_socket(const sdp_session_t *session); * SDP transaction: functions for asynchronous search. */ sdp_session_t *sdp_create(int sk, uint32_t flags); +int sdp_get_error(sdp_session_t *session); int sdp_process(sdp_session_t *session); int sdp_set_notify(sdp_session_t *session, sdp_callback_t *func, void *udata); -- cgit From 82817924a25fb0eaaeb9824372106870c45c9db9 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 7 Nov 2006 18:30:16 +0000 Subject: Add functions for registering binary records --- include/sdp_lib.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 9a83586f..05bfa7d4 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -443,22 +443,25 @@ void sdp_record_free(sdp_record_t *rec); * the service record visible to SDP clients. This function returns 0 * on success or -1 on failure (and sets errno). */ -int sdp_record_register(sdp_session_t *sess, sdp_record_t *rec, uint8_t flags); -int sdp_device_record_register(sdp_session_t *sess, bdaddr_t *device, sdp_record_t *rec, uint8_t flags); +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); +int sdp_device_record_register(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec, uint8_t flags); +int sdp_record_register(sdp_session_t *session, sdp_record_t *rec, uint8_t flags); /* * Unregister a service record. */ -int sdp_record_unregister(sdp_session_t *sess, sdp_record_t *rec); -int sdp_device_record_unregister(sdp_session_t *sess, bdaddr_t *device, sdp_record_t *rec); +int sdp_device_record_unregister_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle); +int sdp_device_record_unregister(sdp_session_t *session, bdaddr_t *device, sdp_record_t *rec); +int sdp_record_unregister(sdp_session_t *session, sdp_record_t *rec); /* * Update an existing service record. (Calling this function * before a previous call to sdp_record_register() will result * in an error.) */ +int sdp_device_record_update_binary(sdp_session_t *session, bdaddr_t *device, uint32_t handle, uint8_t *data, uint32_t size); +int sdp_device_record_update(sdp_session_t *session, bdaddr_t *device, const sdp_record_t *rec); int sdp_record_update(sdp_session_t *sess, const sdp_record_t *rec); -int sdp_device_record_update(sdp_session_t *sess, bdaddr_t *device, const sdp_record_t *rec); void sdp_record_print(const sdp_record_t *rec); -- cgit From 25effaf3a661c4de960ebae7125ba56a990ad628 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 13 Jan 2007 17:50:06 +0000 Subject: Update copyright information --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 05bfa7d4..45f96e4d 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -4,7 +4,7 @@ * * Copyright (C) 2001-2002 Nokia Corporation * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2006 Marcel Holtmann + * Copyright (C) 2002-2007 Marcel Holtmann * Copyright (C) 2002-2003 Stephen Crane * * -- cgit From 5f17af319f0caee2243c5471a6500742ad7d6576 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 5 Mar 2007 20:54:48 +0000 Subject: Export sdp_uuid32_to_uuid128() function --- include/sdp_lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 45f96e4d..9a8ab4fd 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -475,6 +475,7 @@ int sdp_uuid16_cmp(const void *p1, const void *p2); int sdp_uuid128_cmp(const void *p1, const void *p2); uuid_t *sdp_uuid_to_uuid128(uuid_t *uuid); void sdp_uuid16_to_uuid128(uuid_t *uuid128, uuid_t *uuid16); +void sdp_uuid32_to_uuid128(uuid_t *uuid128, uuid_t *uuid32); int sdp_uuid128_to_uuid(uuid_t *uuid); int sdp_uuid_to_proto(uuid_t *uuid); int sdp_uuid_extract(const uint8_t *buffer, uuid_t *uuid, int *scanned); -- cgit From 7208028266fc19d380ac77c97c46b6f2fdc80e1d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 2 Feb 2008 03:11:09 +0000 Subject: Update copyright information --- include/sdp_lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 9a8ab4fd..eac2fe6d 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -4,7 +4,7 @@ * * Copyright (C) 2001-2002 Nokia Corporation * Copyright (C) 2002-2003 Maxim Krasnyansky - * Copyright (C) 2002-2007 Marcel Holtmann + * Copyright (C) 2002-2008 Marcel Holtmann * Copyright (C) 2002-2003 Stephen Crane * * -- cgit From a3648e0df0ff53fef74e5437ff089aef96209db2 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 20 Jun 2008 03:30:53 +0000 Subject: Add more safe version of three low-level extraction functions --- include/sdp_lib.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index eac2fe6d..2323abfc 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -479,6 +479,7 @@ void sdp_uuid32_to_uuid128(uuid_t *uuid128, uuid_t *uuid32); int sdp_uuid128_to_uuid(uuid_t *uuid); int sdp_uuid_to_proto(uuid_t *uuid); int sdp_uuid_extract(const uint8_t *buffer, uuid_t *uuid, int *scanned); +int sdp_uuid_extract_safe(const uint8_t *buffer, int bufsize, uuid_t *uuid, int *scanned); void sdp_uuid_print(const uuid_t *uuid); #define MAX_LEN_UUID_STR 37 @@ -601,8 +602,10 @@ int sdp_gen_pdu(sdp_buf_t *pdu, sdp_data_t *data); int sdp_gen_record_pdu(const sdp_record_t *rec, sdp_buf_t *pdu); int sdp_extract_seqtype(const uint8_t *buf, uint8_t *dtdp, int *seqlen); +int sdp_extract_seqtype_safe(const uint8_t *buf, int bufsize, uint8_t *dtdp, int *size); sdp_data_t *sdp_extract_attr(const uint8_t *pdata, int *extractedLength, sdp_record_t *rec); +sdp_data_t *sdp_extract_attr_safe(const uint8_t *pdata, int bufsize, int *extractedLength, sdp_record_t *rec); void sdp_pattern_add_uuid(sdp_record_t *rec, uuid_t *uuid); void sdp_pattern_add_uuidseq(sdp_record_t *rec, sdp_list_t *seq); -- cgit From 0e1789b3f1897512eb30d63c8e9803f1461446c1 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 22 Jun 2008 21:59:42 +0000 Subject: Add safe version of sdp_extract_pdu function --- include/sdp_lib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 2323abfc..8df540c6 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -585,9 +585,11 @@ static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); } -sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int *scanned); sdp_data_t *sdp_extract_string(uint8_t *, int *); +sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int *scanned); +sdp_record_t *sdp_extract_pdu_safe(const uint8_t *pdata, int bufsize, int *scanned); + void sdp_data_print(sdp_data_t *data); void sdp_print_service_attr(sdp_list_t *alist); -- cgit From 66e753bae1b6dd26ba78efdf345f45c362bb2463 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sun, 22 Jun 2008 22:02:27 +0000 Subject: Remove sdp_extract_string prototype --- include/sdp_lib.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/sdp_lib.h') diff --git a/include/sdp_lib.h b/include/sdp_lib.h index 8df540c6..143056f6 100644 --- a/include/sdp_lib.h +++ b/include/sdp_lib.h @@ -585,8 +585,6 @@ static inline int sdp_get_icon_url(const sdp_record_t *rec, char *str, int len) return sdp_get_string_attr(rec, SDP_ATTR_ICON_URL, str, len); } -sdp_data_t *sdp_extract_string(uint8_t *, int *); - sdp_record_t *sdp_extract_pdu(const uint8_t *pdata, int *scanned); sdp_record_t *sdp_extract_pdu_safe(const uint8_t *pdata, int bufsize, int *scanned); -- cgit