⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdp_lib.h

📁 bluetooth 开发库bluez-libs-2.23
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *  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.  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);/* * 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 * 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);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);/* * 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 uint8_t *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 28#define MAX_LEN_PROFILEDESCRIPTOR_UUID_STR 28int 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);/* * 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)  */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);}/* * 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 *);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(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, 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 uint8_t *buf, uint8_t *dtdp, int *seqlen);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, 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#endif /* __SDP_LIB_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -