CServer2 Class Reference

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)

Inherits from

Public Member Functions
~CServer2()
IMPORT_C voidReStart()
RServer2 Server()
IMPORT_C voidSetMaster(const CServer2 *)
IMPORT_C voidSetPinClientDescriptors(TBool)
IMPORT_C TIntStart(const TDesC &)
IMPORT_C voidStartL(const TDesC &)
Protected Member Functions
CServer2(TInt, TServerType)
IMPORT_C voidDoCancel()
IMPORT_C voidDoConnect(const RMessage2 &)
IMPORT_C TIntExtension_(TUint, TAny *&, TAny *)
const RMessage2 &Message()
IMPORT_C TIntRunError(TInt)
IMPORT_C voidRunL()
Private Member Functions
voidBadMessage(const RMessage2 &)
voidConnect(const RMessage2 &)
voidDisconnect(const RMessage2 &)
voidDoConnectL(const RMessage2 &, CSession2 *volatile &)
IMPORT_C CSession2 *NewSessionL(const TVersion &, const RMessage2 &)
voidNotConnected(const RMessage2 &)
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumTPanic { EBadMessageNumber, ESessionNotConnected, ESessionAlreadyConnected, EClientDoesntHaveRequiredCaps }
enumTServerType { EUnsharableSessions = EIpcSession_Unsharable, ESharableSessions = EIpcSession_Sharable, EGlobalSharableSessions = EIpcSession_GlobalSharable }
Inherited Enumerations
CActive:TPriority
Protected Attributes
TDblQueIter< CSession2 >iSessionIter
Private Attributes
RMessage2 iMessage
RServer2 iServer
TUint16 iServerOpts
TUint8 iServerRole
TDblQue< CSession2 >iSessionQ
TUint8 iSessionType
TAny *iSpare
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CServer2(TInt, TServerType)

IMPORT_CCServer2(TIntaPriority,
TServerTypeaType = EUnsharableSessions
)[protected]

Parameters

TInt aPriority
TServerType aType = EUnsharableSessions

~CServer2()

IMPORT_C~CServer2()[pure virtual]

Member Functions Documentation

BadMessage(const RMessage2 &)

voidBadMessage(const RMessage2 &aMessage)[private, static]

Parameters

const RMessage2 & aMessage

Connect(const RMessage2 &)

voidConnect(const RMessage2 &aMessage)[private]

Parameters

const RMessage2 & aMessage

Disconnect(const RMessage2 &)

voidDisconnect(const RMessage2 &aMessage)[private]

Parameters

const RMessage2 & aMessage

DoCancel()

IMPORT_C voidDoCancel()[protected, virtual]

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().

CActive::Cancel

DoConnect(const RMessage2 &)

IMPORT_C voidDoConnect(const RMessage2 &aMessage)[protected, virtual]

Parameters

const RMessage2 & aMessage

DoConnectL(const RMessage2 &, CSession2 *volatile &)

voidDoConnectL(const RMessage2 &aMessage,
CSession2 *volatile &aSession
)[private]

Parameters

const RMessage2 & aMessage
CSession2 *volatile & aSession

Extension_(TUint, TAny *&, TAny *)

IMPORT_C TIntExtension_(TUintaExtensionId,
TAny *&a0,
TAny *a1
)[protected, virtual]

Parameters

TUint aExtensionId
TAny *& a0
TAny * a1

Message()

const RMessage2 &Message()const [protected, inline]

Gets a reference to the server's current message.

The current message that contains the client request details.

NewSessionL(const TVersion &, const RMessage2 &)

IMPORT_C CSession2 *NewSessionL(const TVersion &aVersion,
const RMessage2 &aMessage
)const [private, pure virtual]

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() 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.

A pointer to the newly created server-side session object.

User::QueryVersionSupported()

Parameters

const TVersion & aVersionThe version information supplied by the client.
const RMessage2 & aMessageRepresents the details of the client request that is requesting the creation of the session.

NotConnected(const RMessage2 &)

voidNotConnected(const RMessage2 &aMessage)[private, static]

Parameters

const RMessage2 & aMessage

ReStart()

IMPORT_C voidReStart()

RunError(TInt)

IMPORT_C TIntRunError(TIntaError)[protected, virtual]

Parameters

TInt aError

RunL()

IMPORT_C voidRunL()[protected, virtual]

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:

1. decided that this is the highest priority active object with a completed request

2. marked this active object's request as complete (i.e. the request is no longer outstanding)

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.

CActiveScheduler::Start

CActiveScheduler::Error

CActiveScheduler::WaitForAnyRequest

TRAPD

Server()

RServer2 Server()const [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.

The handle to the server.

SetMaster(const CServer2 *)

IMPORT_C voidSetMaster(const CServer2 *aServer)

Parameters

const CServer2 * aServer

SetPinClientDescriptors(TBool)

IMPORT_C voidSetPinClientDescriptors(TBoolaPin)

Parameters

TBool aPin

Start(const TDesC &)

IMPORT_C TIntStart(const TDesC &aName)

Parameters

const TDesC & aName

StartL(const TDesC &)

IMPORT_C voidStartL(const TDesC &aName)

Parameters

const TDesC & aName

Member Enumerations Documentation

Enum TPanic

Enumerators

EBadMessageNumber
ESessionNotConnected
ESessionAlreadyConnected
EClientDoesntHaveRequiredCaps

Enum TServerType

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

Enumerators

EUnsharableSessions = EIpcSession_Unsharable
ESharableSessions = EIpcSession_Sharable
EGlobalSharableSessions = EIpcSession_GlobalSharable

Member Data Documentation

RMessage2 iMessage

RMessage2 iMessage[private]

RServer2 iServer

RServer2 iServer[private]

TUint16 iServerOpts

TUint16 iServerOpts[private]

TUint8 iServerRole

TUint8 iServerRole[private]

TDblQueIter< CSession2 > iSessionIter

TDblQueIter< CSession2 >iSessionIter[protected]

TDblQue< CSession2 > iSessionQ

TDblQue< CSession2 >iSessionQ[private]

TUint8 iSessionType

TUint8 iSessionType[private]

TAny * iSpare

TAny *iSpare[private]