|
||
class CServer2 : public CActive;
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)
CBase
-
Base class for all classes to be instantiated on the heap.
CActive
-
The core class of the active object abstraction.
CServer2
-
Abstract base class for servers (version 2).
Defined in CServer2
:
CServer2(TInt,TServerType)
Constructs the server object, specifying the server type and the active object p...DoCancel()
Implements the cancellation of any outstanding request for messages. DoConnect(const RMessage2 &)
Handles the connect request from the client.EGlobalSharableSessions
The session is sharable with all other threads in the system.ESharableSessions
The session is sharable with other threads in the same process.EUnsharableSessions
The session is not sharable with other threads.Extension_(TUint,TAny *&,TAny *)
Extension function Message()const
Gets a reference to the server's current message.NewSessionL(const TVersion &,const RMessage2 &)const
Creates a server-side session object.ReStart()
Restarts the server.RunError(TInt)
Handles the situation where a call to CServer2::RunL(), leaves.RunL()
Handles the receipt of a message. Server()const
Gets a handle to the server.Start(const TDesC &)
Adds the server with the specified name to the active scheduler, and issues the ...StartL(const TDesC &)
Adds the server with the specified name to the active scheduler, and issues the ...TServerType
Defines the set of session types that the server can create.iSessionIter
~CServer2()
Frees resources prior to destruction.Inherited from CActive
:
CActive(TInt)
Constructs the active object with the specified priority.Cancel()
Cancels the wait for completion of an outstanding request.Deque()
Removes the active object from the active scheduler's list of active objects.EPriorityHigh
A priority higher than EPriorityUserInput.EPriorityIdle
A low priority, useful for active objects representing background processing.EPriorityLow
A priority higher than EPriorityIdle but lower than EPriorityStandard.EPriorityStandard
Most active objects will have this priority.EPriorityUserInput
A priority higher than EPriorityStandard; useful for active objects handling use...IsActive()const
Determines whether the active object has a request outstanding.IsAdded()const
Determines whether the active object has been added to the active scheduler's li...Priority()const
Gets the priority of the active object.SetActive()
Indicates that the active object has issued a request and that it is now outstan...SetPriority(TInt)
Sets the priority of the active object.TPriority
Defines standard priorities for active objects. iStatus
The request status associated with an asynchronous request.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...IMPORT_C virtual ~CServer2()=0;
Frees resources prior to destruction.
Specifically, it cancels any outstanding request for messages, and deletes all server-side client session objects.
protected: IMPORT_C CServer2(TInt aPriority, TServerType aType=EUnsharableSessions);
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.
|
Capability: | ProtServ | if aName starts with a '!' character |
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.
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(const TDesC &,const TVersion &)
which takes RServer2
object as a parameter can be used.
|
|
Capability: | ProtServ | if aName starts with a '!' character |
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.
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(const TDesC &,const TVersion &)
which takes an RServer2
object as a parameter can be used.
|
IMPORT_C void ReStart();
Restarts the server.
The function issues a request for messages.
inline RServer2 Server() const;
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(const TDesC &,const TVersion &)
variants that take a server handle.
|
protected: inline const RMessage2& Message() const;
Gets a reference to the server's current message.
|
protected: IMPORT_C virtual void DoCancel();
Implements the cancellation of any outstanding request for messages.
protected: IMPORT_C virtual TInt RunError(TInt aError);
Handles the situation where a call to CServer2::RunL()
, leaves.
This is the server active object's implementation of the active object framework's CServer2::RunError(TInt)
function.
In practice, the leave can only be caused by a session's ServiceL() function, which is called from this CServer2::RunL()
; this error is reflected back to that session by calling its ServiceError() function.
|
|
CActive::RunL()
Handles an active object's request completion event.CActive::RunError(TInt)
Handles a leave occurring in the request completion event handler CActive::RunL(...CSession2::ServiceError(const RMessage2 &,TInt)
Handles the situation when a call to CSession2::ServiceL(const RMessage2 &),...protected: IMPORT_C virtual void DoConnect(const RMessage2 &aMessage);
Handles the connect request from the client.
|
protected: IMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
Extension function
|
|
private: IMPORT_C virtual CSession2* NewSessionL(const TVersion &aVersion, const RMessage2 &aMessage) const=0;
Creates a server-side session object.
The session represents a communication link between a client and a server, and its creation is initiated by the client through
a call to one of the RSessionBase::CreateSession(const TDesC &,const TVersion &)
variants.
A server must provide an implementation, which as a minimum should:
check that the version of the server is compatible with the client by comparing the client supplied version number against the server's version number; it should leave if there is incompatibility.
construct and return the server side client session object.
|
|
User::QueryVersionSupported(const TVersion &,const TVersion &)
Compares two version objects and returns true if the test version is less than t...TServerType
Defines the set of session types that the server can create.
A specific session type is specified when the CServer2 object is created.
|
protected: TDblQueIter< CSession2 > iSessionIter;