|
Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
|
Abstract base class for servers (version 2). More...
#include <e32base.h>
Public Types | |
| enum | TServerType { EUnsharableSessions = EIpcSession_Unsharable , ESharableSessions = EIpcSession_Sharable , EGlobalSharableSessions = EIpcSession_GlobalSharable } |
| This enumeration defines the maximum sharability of sessions opened with this server; for backwards compatibilty, these should be have the same values as the corresponding EIpcSessionType enumeration. More... | |
| enum | TPanic { EBadMessageNumber , ESessionNotConnected , ESessionAlreadyConnected , EClientDoesntHaveRequiredCaps } |
Public Types inherited from CActive | |
| enum | TPriority { EPriorityIdle =-100 , EPriorityLow =-20 , EPriorityStandard =0 , EPriorityUserInput =10 , EPriorityHigh =20 } |
| Defines standard priorities for active objects. More... | |
Public Member Functions | |
| virtual IMPORT_C | ~CServer2 ()=0 |
| Frees resources prior to destruction. | |
| IMPORT_C TInt | Start (const TDesC &aName) |
| Adds the server with the specified name to the active scheduler, and issues the first request for messages. | |
| IMPORT_C void | StartL (const TDesC &aName) |
| Adds the server with the specified name to the active scheduler, and issues the first request for messages, and leaves if the operation fails. | |
| IMPORT_C void | ReStart () |
| Restarts the server. | |
| IMPORT_C void | SetPinClientDescriptors (TBool aPin) |
| Sets whether the kernel will pin descriptors passed to this server in the context of the client thread. | |
| RServer2 | Server () const |
| Gets a handle to the server. | |
| IMPORT_C void | SetMaster (const CServer2 *aServer) |
| Assigns a role (master or slave) for this server. | |
Public Member Functions inherited from CActive | |
| IMPORT_C | ~CActive () |
| Frees resources prior to destruction. | |
| IMPORT_C void | Cancel () |
| Cancels the wait for completion of an outstanding request. | |
| IMPORT_C void | Deque () |
| Removes the active object from the active scheduler's list of active objects. | |
| IMPORT_C void | SetPriority (TInt aPriority) |
| Sets the priority of the active object. | |
| TBool | IsActive () const |
| Determines whether the active object has a request outstanding. | |
| TBool | IsAdded () const |
| Determines whether the active object has been added to the active scheduler's list of active objects. | |
| TInt | Priority () const |
| Gets the priority of the active object. | |
Public Member Functions inherited from CBase | |
| CBase () | |
| Default constructor. | |
| virtual IMPORT_C | ~CBase () |
| Virtual destructor. | |
| TAny * | operator new (TUint aSize, TAny *aBase) __NO_THROW |
| Initialises the object to binary zeroes. | |
| TAny * | operator new (TUint aSize) __NO_THROW |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TLeave) |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TUint aExtraSize) __NO_THROW |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
| TAny * | operator new (TUint aSize, TLeave, TUint aExtraSize) |
| Allocates the object from the heap and then initialises its contents to binary zeroes. | |
Protected Member Functions | |
| const RMessage2 & | Message () const |
| Gets a reference to the server's current message. | |
| IMPORT_C | CServer2 (TInt aPriority, TServerType aType=EUnsharableSessions) |
| Constructs the server object, specifying the server type and the active object priority. | |
| IMPORT_C void | DoCancel () |
| Implements cancellation of an outstanding request. | |
| IMPORT_C void | RunL () |
| Handles an active object's request completion event. | |
| IMPORT_C TInt | RunError (TInt aError) |
| Handles the situation where a call to CServer2::RunL(), leaves. | |
| virtual IMPORT_C void | DoConnect (const RMessage2 &aMessage) |
| Handles the connect request from the client. | |
| virtual IMPORT_C TInt | Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1) |
| Extension function. | |
Protected Member Functions inherited from CActive | |
| IMPORT_C | CActive (TInt aPriority) |
| Constructs the active object with the specified priority. | |
| IMPORT_C void | SetActive () |
| Indicates that the active object has issued a request and that it is now outstanding. | |
Protected Attributes | |
| TDblQueIter< CSession2 > | iSessionIter |
Friends | |
| class | CPolicyServer |
Additional Inherited Members | |
Static Public Member Functions inherited from CBase | |
| static IMPORT_C void | Delete (CBase *aPtr) |
| Deletes the specified object. | |
Public Attributes inherited from CActive | |
| TRequestStatus | iStatus |
| The request status associated with an asynchronous request. | |
Abstract base class for servers (version 2).
This is an active object. It accepts requests from client threads and forwards them to the relevant server-side client session. It also handles the creation of server-side client sessions as a result of requests from client threads.
A server must define and implement a derived class.
(Note that this class should be used instead of CServer)
| enum CServer2::TPanic |
|
pure virtual |
Frees resources prior to destruction.
Specifically, it cancels any outstanding request for messages, and deletes all server-side client session objects.
(generated from Symbian Developer Library)
|
protected |
Constructs the server object, specifying the server type and the active object priority.
Derived classes must define and implement a constructor through which the priority can be specified. A typical implementation calls this server base class constructor through a constructor initialization list.
| aPriority | The priority of this active object. |
| aType | Indicates the type of session that the server creates. If not explicitly stated, then the server creates a session that is not sharable with other threads. |
(generated from Symbian Developer Library)
|
protectedvirtual |
Implements cancellation of an outstanding request.
This function is called as part of the active object's Cancel().
It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.
DoCancel() must not wait for event completion; this is handled by Cancel().
Implements CActive.
|
protectedvirtual |
Handles the connect request from the client.
We trap Leaves, to ensure that existing sessions aren't affected by failure to create a new one.
| aMessage | The Connect message sent by the client requesting the connection. aMessage.Ptr0() is the required Version. |
(generated from Symbian Developer Library)
|
protectedvirtual |
Extension function.
(generated from Symbian Developer Library)
Reimplemented from CActive.
Reimplemented in CPolicyServer.
|
inlineprotected |
Gets a reference to the server's current message.
(generated from Symbian Developer Library)
| IMPORT_C void CServer2::ReStart | ( | ) |
Restarts the server.
The function issues a request for messages.
(generated from Symbian Developer Library)
|
protectedvirtual |
Handles the situation where a call to CServer2::RunL(), leaves.
This is the server active object's implementation of the active object framework's RunError() function.
In practice, the leave can only be caused by a session's ServiceL() function, which is called from this RunL(); this error is reflected back to that session by calling its ServiceError() function.
CActive::RunL() CActive::RunError() CSession2::ServiceError()
| aError | The leave code. |
(generated from Symbian Developer Library)
Reimplemented from CActive.
|
protectedvirtual |
Handles an active object's request completion event.
A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.
The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.
Before calling this active object's RunL() function, the active scheduler has:
RunL() runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls RunError() to handle the leave.
Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active object's RunL() or RunError() functions.
Implements CActive.
|
inline |
Gets a handle to the server.
Note that the RServer2 object is classified as Symbian internal, and its member functions cannot be acessed. However, the handle can be passed to the RSessionBase::CreateSession() variants that take a server handle.
| IMPORT_C void CServer2::SetMaster | ( | const CServer2 * | aServer | ) |
Assigns a role (master or slave) for this server.
The master server is typically named, and receives all Connect messages from clients. It can hand off some sessions to be processed by one or more anonymous slave servers, each running in a separate thread.
Both master and slave servers must call this function before calling Start(), in order to define their roles. Once the server is started, its role cannot be changed.
Panic condition: E32USER-CBase-? When this method is invoked after the server has been started.
(generated from Symbian Developer Library)
| IMPORT_C void CServer2::SetPinClientDescriptors | ( | TBool | aPin | ) |
Sets whether the kernel will pin descriptors passed to this server in the context of the client thread.
Setting this is one way of ensuring that the server will not take page faults when accessing client descriptors, which would otherwise happen if the data was paged out.
This method overrides the default pinning policy of the server which is for the server to pin its client's descriptors if the process creating the server is not data paged. I.e. if CServer2::SetPinClientDescriptors() is not invoked on the server and RProcess::DefaultDataPaged() of the process creating the server returns EFalse, the server will pin its client's descriptors, otherwise the server will not pin its client's descriptors.
This method must be called prior to starting the server by calling the Start() method.
| aPin | Set to ETrue for the server to pin its client's descriptors, set to EFalse otherwise. |
Panic condition: E32USER-CBase 106 When this method is invoked after the server has been started.
(generated from Symbian Developer Library)
| IMPORT_C TInt CServer2::Start | ( | const TDesC & | aName | ) |
Adds the server with the specified name to the active scheduler, and issues the first request for messages.
If KNullDesC is specified for the name, then an anonymous server will be created. To create a session to such a server, an overload of RSessionBase::CreateSession() which takes RServer2 object as a parameter can be used.
| aName | The name of the server. KNullDesC, to create anonymous servers. |
(generated from Symbian Developer Library)
| IMPORT_C void CServer2::StartL | ( | const TDesC & | aName | ) |
Adds the server with the specified name to the active scheduler, and issues the first request for messages, and leaves if the operation fails.
If KNullDesC is specified for the name, then an anonymous server will be created. To create a session to such a server, the overload of RSessionBase::CreateSession() which takes an RServer2 object as a parameter can be used.
| aName | The name of the server. KNullDesC, to create anonymous servers. |
(generated from Symbian Developer Library)
|
friend |
|
protected |