Share via


Packet Routing

The extension layer can choose to listen to all or selected type of events. For example, if the stack wants to only accept connections from one device, it issues BTH_CONTROL_ROUTE_BY_ADDR and provides a single pointer to the Bluetooth device address (*pba). If it is prepared to accept only SCO (synchronous connection-oriented) connections, it provides appropriate link type (link_type) and BTH_CONTROL_ROUTE_BY_LINKTYPE. The same process applies to the class of the device.

To set the routing option, you need to pass the second flag in the uiControl argument when calling HCI_EstablishDeviceContext. The following six options are available.

BTH_CONTROL_ROUTE_ALL

This option is typically reserved for the default handler such as the L2CAP stack. Only one stack can register to accept all the notifications. A notification is passed up to this stack if there are no other stacks registered for this event.

BTH_CONTROL_DEVICEONLY

Use this option to route all local device control packets here. This is used for local device control, that is, place a device into a particular operating mode, one can register for this access, use this callback to program the device, and then deregister. Only one client at a time is allowed. This option is typically used for management layers that do not accept incoming connections at all. There may be more than one of these.

BTH_CONTROL_ROUTE_SECURITY

Use this option to route all security events up this stack including PIN requests. This is used to implement the security manager. With this option, link key/PIN requests for all connections will be forwarded to this stack layer. Only one stack is allowed to be handled for security events.

BTH_CONTROL_ROUTE_BY_ADDR

This option routes all callbacks associated with a particular device up this stack. Only one client is allowed for each BD_ADDR structure.

BTH_CONTROL_ROUTE_BY_COD

Use this option to route connection requests associated with this COD up this stack. Only one client is allowed for each COD.

BTH_CONTROL_ROUTE_BY_LINKTYPE

Use this option to route connection requests associated with this link type up this stack. This is used to implement SCO connections. A sample SCO connection scenario includes registering for a particular Bluetooth device, processing all SCO data packets here, and then returning all L2CAP packets to the L2CAP layer.

See Also

Establishing Connections through HCI | Enhancing the Bluetooth Stack

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.