CScsSession Class Reference

class CScsSession : public CSession2

When this session object is destroyed (because the client-server session has closed,) this notifies the server object which decrements the session count. Therefore, the server can be shut down after an inactivity period during which there are no open sessions.

This object also frees any remaining subsession objects when it is closed.

Inherits from

Public Member Functions
CScsSession ( CScsServer &)
Protected Member Functions
~CScsSession ()
IMPORT_C void CloseAllSubsessionsL ()
IMPORT_C void ConstructL ()
IMPORT_C void ServiceError (const RMessage2 &, TInt )
IMPORT_C void ServiceL (const RMessage2 &)
Private Member Functions
TBool CallSubsessionFunctionL ( TInt , const RMessage2 &)
void CancelAsyncSessionRequestL ( TInt )
void CancelAsyncSubsessionRequestL ( TInt , const RMessage2 &)
void CloseSubsessionL (const RMessage2 &)
void CreateSubsessionL ( TInt , const RMessage2 &)
void DeleteSubsessionContainers ()
IMPORT_C CScsSubsession * DoCreateSubsessionL ( TInt , const RMessage2 &)
TBool DoServiceL ( TInt , const RMessage2 &)
CAsyncRequest * FindSessionAsyncRequest ( TInt )
CScsSubsession * GetSubsessionL (const RMessage2 &)
void PreCloseSession ()
Inherited Functions
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()
CSession2::CSession2()
CSession2::CountResources()
CSession2::Disconnect(const RMessage2 &)
CSession2::Extension_(TUint,TAny *&,TAny *)
CSession2::ResourceCountMarkEnd(const RMessage2 &)
CSession2::ResourceCountMarkStart()
CSession2::Server()const
CSession2::SetServer(const CServer2 *)
CSession2::~CSession2()
Inherited Enumerations
CSession2:TPanicNo
Public Attributes
CScsServer & iServer
Private Attributes
TInt iPreCreateSubsessionCount
CObjectIx * iSsHandles
CObjectCon * iSsObjects

Constructor & Destructor Documentation

CScsSession(CScsServer &)

IMPORT_C CScsSession ( CScsServer & aServer )

Setup the iServer member variable so it can be used during construction

Parameters

CScsServer & aServer

~CScsSession()

IMPORT_C ~CScsSession ( ) [protected, virtual]

Deletes any subsessions.

Deletes any outstanding requests.

Decrements the server's session count so the server can be shut down if there are no open sessions.

Member Functions Documentation

CallSubsessionFunctionL(TInt, const RMessage2 &)

TBool CallSubsessionFunctionL ( TInt aFunction,
const RMessage2 & aMessage
) [private]

Pass the supplied function identifier and message to the subsession which is identified in the message.

If the subsession cannot be found this function leaves with KErrBadHandle, and the client is panicked in ServiceError.

Parameters

TInt aFunction Function identifier without SCS code.
const RMessage2 & aMessage Client message.

CancelAsyncSessionRequestL(TInt)

void CancelAsyncSessionRequestL ( TInt aFunction ) [private]

This function is called when handling an ECancelSessionFunction message. If the outstanding function cannot be found, this function does nothing.

Parameters

TInt aFunction Implementation function without SCS code.

CancelAsyncSubsessionRequestL(TInt, const RMessage2 &)

void CancelAsyncSubsessionRequestL ( TInt aFunction,
const RMessage2 & aMessage
) [private]

Cancel an outstanding asynchronous request for the subsession identified in the supplied message.

Parameters

TInt aFunction Function identifier without SCS code.
const RMessage2 & aMessage Standard server-side message handle. The fourth integer contains the subsession handle.

CloseAllSubsessionsL()

IMPORT_C void CloseAllSubsessionsL ( ) [protected]

CloseSubsessionL(const RMessage2 &)

void CloseSubsessionL ( const RMessage2 & aMessage ) [private]

Delete the subsession identified in the supplied message.

If the subsession cannot be found this function leaves with KErrBadHandle, and the client is panicked in ServiceError.

Parameters

const RMessage2 & aMessage Standard server-side message handle. The fourth integer contains the subsession handle.

ConstructL()

IMPORT_C void ConstructL ( ) [protected]

The subsession [handle] container could be constructed here, but that is deferred until the subsession is allocated to avoid the memory overhead for sessions which may not require subsessions.

CreateSubsessionL(TInt, const RMessage2 &)

void CreateSubsessionL ( TInt aFunction,
const RMessage2 & aMessage
) [private]

Attempt to allocate a subsession object for this session. The actual subsession allocation is delegated to the subclass's implementation of DoCreateSubsessionL. If the subclass has not reimplemented this function, then default implementation leaves with KErrNotSupported.

Parameters

TInt aFunction Function identifier without SCS code.
const RMessage2 & aMessage Standard server-side message object.

DeleteSubsessionContainers()

void DeleteSubsessionContainers ( ) [private]

Free the handle and object containers which this session uses to manage subsessions. It is safe to call this function if the containers were not set up successfully.

DoCreateSubsessionL(TInt, const RMessage2 &)

IMPORT_C CScsSubsession * DoCreateSubsessionL ( TInt aFunction,
const RMessage2 & aMessage
) [private, virtual]

This default implementation leaves with KErrNotSupported. The subclass does not have to supply its own implementation unless it actually wants to support subsessions.

leave
KErrNotSupported.

Parameters

TInt aFunction Function identifier without SCS code. The subclass implementation of this function would use this to decide what kind of subsession object to create.
const RMessage2 & aMessage Client message. Not used.

DoServiceL(TInt, const RMessage2 &)

TBool DoServiceL ( TInt aFunction,
const RMessage2 & aMessage
) [private, pure virtual]

This function is called from ServiceL after it has removed the SCS-specific field and handled any other messages. I.e., it is called for functions which really require the session as opposed to subsession commands or debugging commands such as heap failure.

Parameters

TInt aFunction Implementation function, i.e. the function identifier with the SCS field removed.
const RMessage2 & aMessage Standard server message object.

FindSessionAsyncRequest(TInt)

CAsyncRequest * FindSessionAsyncRequest ( TInt aFunction ) [private]

Parameters

TInt aFunction

GetSubsessionL(const RMessage2 &)

CScsSubsession * GetSubsessionL ( const RMessage2 & aMessage ) [private]

Extract subsession handle from the supplied message and return a pointer to the corresponding subsession object.

leave
KErrBadHandle if the handle does not identify a current subsession.

Parameters

const RMessage2 & aMessage Standard server-side message object. The fourth argument is the subsession handle.

PreCloseSession()

void PreCloseSession ( ) [private]

This function is invoked from RScsClientBase::Close just before the session is closed, to cancel any outstanding requests.

ServiceError(const RMessage2 &, TInt)

IMPORT_C void ServiceError ( const RMessage2 & aMessage,
TInt aError
) [protected, virtual]

Override CSession2 by handling any leave which occurred during the ServiceL.

Panick the client if the leave is because of a bad descriptor or subsession handle. Otherwise, complete the request with the error code.

CSession2::ServiceError

Parameters

const RMessage2 & aMessage Message which caused leave to occur.
TInt aError Leave code. This is a Symbian OS error code.

ServiceL(const RMessage2 &)

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

Implement CSession2 by handling any SCS-specific messages, and otherwise delegating to the subclass' implementation.

Parameters

const RMessage2 & aMessage Standard server-side message object.

Member Data Documentation

TInt iPreCreateSubsessionCount

TInt iPreCreateSubsessionCount [private]

Number of open subsessions before a new one is created. This is used to manage cleanup if the subsession cannot be created.

CScsServer & iServer

CScsServer & iServer

CObjectIx * iSsHandles

CObjectIx * iSsHandles [private]

CObjectCon * iSsObjects

CObjectCon * iSsObjects [private]