The Symbian OS (779886), страница 49
Текст из файла (страница 49)
This creates what is, in effect, a raw serial linkover the chosen port (either an actual serial port, or virtualized overBluetooth, infrared, or USB) to another, connected device. Clients canalso access serial services through the Socket Server.As well as providing a client API, the Serial Server defines theframework interface that communications plug-in modules (CSY files)implement.
A CSY module is implemented as a polymorphic DLL (witha CSY extension, by convention) that exports a factory function for aCSerial-derived CPort class object. CSY implementations are supplied for true RS232 serial ports and serial port emulation over IrDA,Bluetooth and USB. At the level below the plug-in modules, logical andphysical device drivers implement the hardware-level interfaces.SocketsSockets were first introduced as a networking abstraction in Berkeley Unix(BSD), providing a generic mechanism to associate a communicationsprotocol with a data pipe (dedicated communications channel) connecting two processes, transparently of where the processes were actuallyrunning and using a simple, file-type semantics.
The ESock Socket Serverprovides sockets-based communications on Symbian OS through a clientsession API and an underlying framework for creating and loading protocol implementation plug-ins (PRT files) that determine the type of the214THE COMMS SERVICES BLOCKsocket and provide the underlying protocol implementations. Socketsbased protocol implementations are supplied allowing services to be runover a wide range of possible bearer protocols including Bluetooth, IrDA,TCP/IP and SMS.The sockets abstraction provides a common client interface to networking, serial and short-link communications protocols, providing a socketsAPI plus name and address resolution and connection management.ESock was originally provided as part of the networking implementation of the first Symbian OS release, but over subsequent releases it hasevolved into a more generic mechanism for requesting any communications services.
Since Symbian OS v8, the Socket Server presents itselfto the Comms Root Server as a collection of CPMs whose purpose is toprovide protocol sessions to requesting clients by finding and loading anappropriate protocol module, serving it through a client session to theclient, transparently managing the shared data structures and channelsused for socket communications, monitoring and cleaning up after threadpanics and, generally, performing all necessary housekeeping functionsand resource management.Clients connect to the ESock server with a Connect() call and thenopen a sub-session by calling Open() on a socket of the chosen type.The socket type is based on the transport protocol. In response to a socketrequest from a client, the Socket Server loads an appropriate protocolmodule (PRT file) that implements the requested protocol.In Symbian OS v9, the Socket Server is multi-threaded, improvingperformance.Network InterfacesThe underlying interface to the network transport layers is provided bythe Network Interface Manager, or NIFMan, and its supporting components, which load interface agents (AGT files) to establish networkconnections and then create an appropriate network interface (NIF file).Connections supported at Symbian OS v9 are either circuit-switched orpacket-switched data connections running through telephony services,or an Ethernet implementation running over serial communications orshort-link services.
The chosen network interface is bound to the TCP/IPstack. NIFMan defines the plug-in framework (i.e. the base classes fromwhich plug-ins must derive and hence the interfaces they must implement) for the network controller modules. A network controller ownsboth networks and bearers.The Network Controller component is used by the Network Interfacemanager to select a suitable outgoing interface, for example from thosepre-configured in the Comms Database. It loads first the appropriate agentto establish the physical connection and then the appropriate networkinterface. Thereafter, data can flow between the requesting client and theCOMMS FRAMEWORK215network interface through the loaded PRT stack module and the SocketServer that loads it.At the lowest level of the networking services are the modules thatimplement the interfaces to the physical link layer, the plug-ins to theNetwork Interface Manager (NIF files) and other related low-level plugins.
Supported interface types include Ethernet, PPP, SLIP and a tunnelingNIF, each of which can serve as an interface to different physical linklayer carriers, for example physical cable or infrared implementations ofserial communications, Bluetooth, GPRS, and so on.NIFMan can be thought of as the server that manages the overallcontrol of network and bearer selection, delegating the actual work to theNetwork Controller and the agents that plug-in to NIFMan. Agents arethe workhorses that manage the pairings of networks to bearers.
Typicalbearers might include:• a GSM radio network supporting circuit-switched data calls• a CDMA95 radio network supporting circuit-switched data calls• a GSM radio network supporting packet-switched data contexts• a UMTS radio network supporting packet-switched data contexts• a CDMA2000 radio network supporting packet-switched data contexts• an Ethernet wired network connection to a LAN• an 802.11 (Wi-Fi) radio network connection to a LAN.With multi-homing, there may be multiple access technologies available to reach the same network destination.
For example, a given network(an Internet ISP, say) may be reachable by all of the following: circuitswitched data (for example, a GSM data call), packet-switched data (forexample, a GPRS connection) or WLAN (directly via Wi-Fi or perhaps viaBluetooth connection to a PC). In contrast, another network (the user’s 3Gmobile network, for example) may be reachable only by packet-switcheddata. Multi-homing enables each network and bearer combination tobe separately defined, so that the relationship of networks to bearers isno longer 1:1 but one to many (i.e.
multiple combinations for a givennetwork, based on all the possible bearers).Shared SettingsHistorically in Symbian OS, the Comms Database, or CommDB, is therepository in which all communications-related settings and configurationinformation is stored. Settings are used, for example, by system-level components for default host-name resolution and to determine connectionpreferences, availability of physical modems, services, configured ISPs,216THE COMMS SERVICES BLOCKGPRS access points, LAN services, and so on, as well as by applicationsthat, for example, may need to allow users to set or change settings.As well as containing preferences and settings, CommDB provides theutilities needed to set, store and manipulate settings and to read and writesettings into XML formats.CommDB has been a part of the system since the first Symbian OSreleases. In Symbian OS v9, however, its functions are replaced bythe Central Repository, to which the CommsDat component providesa communications-specific interface for stored settings.
Compatibility ismaintained for old-style CommDB requests.Component CollectionsComms Process and Settings CollectionThe Comms Root Server provides the main thread in the communicationsprocess and is responsible for starting and managing all other communications process threads.
These are started at device boot, rather than ondemand, as in previous operating system releases. See Figure 9.9.Table 9.1 Comms Process and Settings ComponentsComponent NameDevelopment NameComms Root ServerROOTSERVERIt provides client-side APIs for loading, configuring and bindingprovider modules; polices any relevant security policies; and publishes aPublish & Subscribe property to notify thread death of provider modules.Processes &Settings CommsCommsRootServerFigure 9.9 Comms Process and Settings componentsComms Configuration Utilities CollectionCommunications-related settings and configuration information are usedto set and determine the host name, connection and service providerdefaults.
The Comms Database (CommDB) is the legacy repository that,COMMS FRAMEWORK217CommsConfig. UtilsCommsDbase.Figure 9.10 Comms Configuration Utilities componentsTable 9.2 Comms Process and Settings ComponentsComponent NameDevelopment NameComms DatabaseCOMMSDAT, COMMDB SHIM,COMMDB COMPATfrom Symbian OS v9, is replaced by the CommsDat interface to the CentralRepository, although the CommDB API is preserved for compatibility. SeeFigure 9.10.Data Comms Server CollectionThis collection contains servers and supporting components that providethe key client interfaces for data communications. See Figure 9.11.Table 9.3 Data Comms Server ComponentsComponent NameDevelopment NameC32 Serial ServerC32ESock ServerESOCKNetwork Interface ManagerNIFMAN, DIALOGNetwork ControllerNETCON• The C32 Serial Server provides the client session APIs and serverimplementation for serial type communications and the frameworkData Comms ServerC32SerialServerFigure 9.11ESockServerNetworkInter- NetworkfaceCntrllr.Mgr.Data Comms Server components218THE COMMS SERVICES BLOCKfor creating and loading the communications plug-in modules (CSYfiles) that implement the serial-port abstractions, enabling clients toaccess virtual serial ports independently of the underlying hardware.• The ESock Socket Server provides the client-session APIs and serverimplementation for sockets-based communications and the frameworkfor creating and loading protocol implementation plug-ins (PRT files).• The Network Interface Manager provides the bearer-level support forthe Socket Server, providing the framework for creating, loading andmanaging interface agent (AGT file) and interface plug-ins (NIF files).Interface agents find and load network-interface implementations andbind them to the TCP/IP stack to create the bearer-level connectionsover which the socket protocols served to clients by the Socket Serveractually run.• The Network Controller is the component that selects a networkinterface agent to create an appropriate network interface.
It readsconnection preferences for the client from stored communicationssettings, based on which it chooses both a network and a bearer(i.e. an access technology). Having made its choice, it loads theappropriate agent. It is implemented as a plug-in library loaded by theNetwork Interface Manager.Comms Framework UtilitiesThese utilities provide framework support for the Root Server and forComms Provider Module mechanisms.