Converting SDP Records to a Tree Structure

Service Discovery Protocol (SDP) records are encoded in a complex binary stream. To enable profile drivers to parse SDP records more easily, the Bluetooth driver stack provides a number of functions that profile drivers can use to convert the SDP record stream into a hierarchical tree structure and back again.

Client profile drivers can use the SdpConvertStreamToTree function to convert an SDP record into a tree structure. The tree representation of the SDP record that results from calling the SdpConvertStreamToTree function consists of a root node that contains all information associated with the SDP record, defined by an SDP_TREE_ROOT_NODE structure. The root node contains a series of interconnected SDP_NODE structures, each of which contains information about a single SDP attribute.

Each SDP_NODE structure contains an SDP_NODE_HEADER structure and an SDP_NODE_DATA union. The header structure specifies the type of data that is contained in the node. Profile drivers use the LIST_ENTRY structure to access links to peer SDP_NODE structures. By using the SDP_NODE structure's hdr.Link.Flink and hdr.Link.Blink members, profile drivers can obtain the addresses of peer nodes in the tree. Keep in mind that LIST_ENTRY pointers hold addresses to other LIST_ENTRY structures, and that profile drivers must use the CONTAINING_RECORD macro to extract the address that contains the node record. For more information, see the SdpConvertStreamToTree topic.

After the SDP record stream is converted to a tree representation, a profile driver can call the SdpFindAttributeInTree function to obtain the address of a specified node in the tree.

Profile drivers can obtain a pointer to all of the functions discussed in this topic by querying for the BTHDDI_SDP_PARSE_INTERFACE and BTHDDI_SDP_NODE_INTERFACE interfaces. For more information about how to query for these interfaces, see Querying for Bluetooth Interfaces.

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft