Introduction to Connection Manager
Connection Manager (CM) is a networking component available on Microsoft Pocket PC and Windows Mobile (WM) OS. CM provides two key services to applications and the OS,
1. Abstracts network resources to applications. It exposes access to all network resources for applications without applications having to refer to any of the resources explicitly. Simply stated, the applications can be completely oblivious to how the connection to their network of choice is established, and at the same time, be confident that the “right” connection path is chosen. CM computes the “best” path for each of the Connection Requests (CRs), connects all connections on it to satisfy the requests, and provides a continuous feed of status notifications to the owner application informing them when status of their CR changes.
2. Resource arbitration. CM manages all network resources, including CSD, GPRS, 1xRTT, Ethernet, VPN, and even voice connections, as they are leased to applications’ CRs to provide access to different destination networks. Use of resources is restricted to different CRs based on their priority and resources’ security properties.
In CM, the Connection Planner is responsible for choosing one or a set of connections (a connection path), that will satisfy CR. During the computation of a connection path, all Connection Service Providers (CSPs) are queried for available connections. A connection contains two important fields used in connection path evaluation,
- Source meta-network. The meta-network such as “Work” or “The Internet,” specified as a GUID, from which the connection connects. If the source meta-network is NULL, the connection connects directly from device.
- Destination meta-network. The meta-network, specified as a GUID, from which the connection connects.
Connection Planner uses these fields to form a path to the requested destination network. As an example, consider CR to “Work,” and a set of available connections:
- My Connection. GPRS connection to “The Internet” (source meta-network is NULL).
- My VPN. VPN connection from “The Internet” to “Work.”
- ACMECORP. WiFi connection to “Work.”
Having this choice of connections, the connection planner has a couple choices in paths that will satisfy the CR,
- My Connection à “The Internet” à My VPN à “Work”
- ACMECORP à “Work”
By default, the planner will choose the connection path that is likely to have the highest bandwidth. In this example, that is the latter path since WiFi typically has higher bandwidth than GPRS plus VPN.
An application uses the fields in CONNMGR_CONNECTIONINFO structure to influence path that is chosen to satisfy its CR. These fields include the destination meta-network or specific connection to use (guidDestNet), flags (dwFlags), and others.
When an application opens a CR, CM will begin evaluating it, a process that involves determination of a path, allocation of resources required to connect, and the actual connecting of connections. During the life of a CR, CM will indicate updates to the CR application owner that reflect connection status of the CR. Subsequent blog entries will talk more about meanings of different statues and their handling.
- Compatibility. Connection Manger was available in the first version of Pocket PC. CM available on the newest WM platforms is a result of many upgrades, however its main purpose has remained the same: abstract network resources to applications and resource arbitration. New APIs have been added, but the functionality provided by first APIs has not changed. Applications using CM APIs and written for the old version of the OS, should compile and run in much the same way on the newer versions of the OS. Unless otherwise stated, this and subsequent blogs are based on functionality supported by WM 5.0 and above.
- Configuration. CSPs are configured with connections using Configuration Service Providers via CM_xxx XML entries (ex. CM_GPRSEntries). Configuration Service Providers are described in, http://msdn.microsoft.com/library/default.asp?url=/library/en-us/DevGuideSP/html/sp_wce51conconfigurationserviceproviderscspsozup.asp.
- Fixed connection path for CRs. Beginning with WM 5.0, an application can specify precisely the connection that CM will use to satisfy its CR. This is done by selecting the connection by name using ConnMgrMapConRef() and passing the returned GUID as guidDestNet field of the CONNMGR_CONNECTIONINFO structure when calling ConnMgrEstablishConnection[Sync](). The disadvantage of this is that the resultant connection path will contain only one connection (ex. no proxies), and the choice of connection may not be optimal (ex. there may be a faster connection available).
[Author: Adam Dyba]