class CScsServer : public CPolicyServer |
The main server object allocates sessions. It also uses a shutdown timer to stop the server when there have been no open sessions for a set period.
The implementor must define a subclass which returns session objects of the appropriate type.
Public Member Functions | |
---|---|
~CScsServer () | |
void | AddAsyncRequestL ( CAsyncRequest *) |
void | CancelAsyncRequest ( CScsSession *, CScsSubsession *, TInt ) |
void | CancelOutstandingRequests ( CScsSession *, TBool ) |
void | CancelOutstandingRequests ( CScsSession *, CScsSubsession *, TBool ) |
void | DecrementSessionCount () |
IMPORT_C void | DoPostHeapMarkOrCheckL () |
IMPORT_C void | DoPreHeapMarkOrCheckL () |
void | IncrementSessionCount () |
TInt | SessionCount () |
IMPORT_C void | ShutdownWhenIdleL () |
TInt | StripScsFunctionMask ( TInt ) |
Protected Member Functions | |
---|---|
CScsServer (const TVersion &, CActive::TPriority ) | |
CScsServer (const TVersion &, const CPolicyServer::TPolicy &, CActive::TPriority ) | |
IMPORT_C void | ConstructL ( TInt ) |
IMPORT_C void | DisableShutdownTimer () |
CScsSession * | DoNewSessionL (const RMessage2 &) |
IMPORT_C void | EnableShutdownTimerL ( TInt ) |
IMPORT_C CSession2 * | NewSessionL (const TVersion &, const RMessage2 &) |
Private Member Functions | |
---|---|
CAsyncRequest * | FindAsyncRequest ( CScsSession *, CScsSubsession *, TInt ) |
TInt | RemoveCompletedRequests ( TAny *) |
void | RemoveCompletedRequests () |
Public Member Enumerations | |
---|---|
enum | TFunctionRanges { EBaseSession = 0x01000000, EBaseSubSession = 0x02000000, EBaseMustAllow = 0x03000000 } |
Inherited Enumerations | |
---|---|
CActive:TPriority | |
CPolicyServer:TCustomResult | |
CPolicyServer:TFailureAction | |
CPolicyServer:TSpecialCase | |
CServer2:TPanic | |
CServer2:TServerType |
Public Attributes | |
---|---|
CAsyncCallBack * | iAsyncCleanup |
RPointerArray < CAsyncRequest > | iAsyncRequests |
CObjectConIx * | iContainerIndex |
Private Attributes | |
---|---|
TInt | iSessionCount |
CShutdownTimer * | iShutdownTimer |
const TVersion | iVersion |
Inherited Attributes | |
---|---|
CActive::iStatus | |
CServer2::iSessionIter |
IMPORT_C | CScsServer | ( | const TVersion & | aVersion, |
CActive::TPriority | aPriority = CActive::EPriorityStandard | |||
) | [protected] |
Record this server's version so it can be compared against the requested version in NewSessionL.
const TVersion & aVersion | This server's version. This is compared against each client's requested version when the client tries to connect. |
CActive::TPriority aPriority = CActive::EPriorityStandard | This server's active object priority. |
IMPORT_C | CScsServer | ( | const TVersion & | aVersion, |
const CPolicyServer::TPolicy & | aPolicy, | |||
CActive::TPriority | aPriority = CActive::EPriorityStandard | |||
) | [protected] |
Record this server's version so it can be compared against the requested version in NewSessionL.
Note that aPolicy must be configured to allow all functions covered by the KScsFunctionMask mask.
const TVersion & aVersion | This server's version. This is compared against each client's requested version when the client tries to connect. |
const CPolicyServer::TPolicy & aPolicy | Can be used to configure security for server connect and session functions |
CActive::TPriority aPriority = CActive::EPriorityStandard | This server's active object priority. |
IMPORT_C | ~CScsServer | ( | ) | [virtual] |
Frees resources used at this level. Specifically, frees the container index, which is used to generate subsession containers, the shutdown timer, and the async request cleanup object.
void | AddAsyncRequestL | ( | CAsyncRequest * | aAsyncRequest | ) |
Add the supplied request to the server's collection.
CAsyncRequest * aAsyncRequest | Request to add. If this function succeeds then ownership has been transferred to the collection. |
void | CancelAsyncRequest | ( | CScsSession * | aSession, |
CScsSubsession * | aSubsession, | |||
TInt | aFunction | |||
) |
Cancels a specific (sub)session request in response to a client command. Also completes the client request.
CancelOutstandingRequest should be called when a (sub)session is closed.
CScsSession * aSession | Session which hosts the request. |
CScsSubsession * aSubsession | Subsession which hosts the request, NULL if the request is relative to a session. |
TInt aFunction | The function identifier, without any SCS code. |
void | CancelOutstandingRequests | ( | CScsSession * | aSession, |
TBool | aCompleteClientRequests | |||
) |
Cancels and deletes all outstanding asynchronous requests associated with the supplied session or any of its subsessions. Does not complete the associated client requests.
This function should be called when a session is closed. CancelAsyncRequest should be called when a specific request is cancelled.
CScsSession * aSession | Session which is being closed. |
TBool aCompleteClientRequests | Whether to complete the client-side requests with KErrCancel. |
void | CancelOutstandingRequests | ( | CScsSession * | aSession, |
CScsSubsession * | aSubsession, | |||
TBool | aCompleteClientRequests | |||
) |
Cancels and deletes all outstanding asynchronous requests associated with the supplied session and subsession. This should be called when a session or subsession is closed.
As an exception, the user-side request is completed when a subsession is closed, else the request would not be completed until the session itself was destroyed.
CancelAsyncRequest should be called when a specific request is cancelled.
CScsSession * aSession | Session which is being closed. |
CScsSubsession * aSubsession | Subsession which is being closed. If this is KWildSubsession then a session is being closed so all of its subsession requests should be destroyed as well. |
TBool aCompleteClientRequests | Whether to complete the client-side requests with KErrCancel. |
IMPORT_C void | ConstructL | ( | TInt | aShutdownPeriodUs | ) | [protected] |
Second-phase constructor allocates the shutdown timer for this server object.
If aShutdownPeriodUs is not 0, this function starts the shutdown timer because the server starts up with no current sessions.
If aShutdownPeriodUs is 0, the timer is not started and the server will not auto-exit.
nb. It must be called, even if you do not want a shutdown timer.
This function does not start the server, i.e. it does not call StartL. The calling function must do this after this function returns.
TInt aShutdownPeriodUs | Shutdown period in microseconds. |
void | DecrementSessionCount | ( | ) |
Record the fact that a session has been deleted. If this was the only remaining session then start the shutdown timer.
Note the shutdown timer may be deferred if a request cleanup is pending.
IMPORT_C void | DisableShutdownTimer | ( | ) | [protected] |
The server will no longer shutdown after the last client session closes. Client calls to RScsClientBase::ShutdownServer will fail with KErrNotSupported.
CScsSession * | DoNewSessionL | ( | const RMessage2 & | aMessage | ) | [protected, pure virtual] |
NewSessionL checks that this server supports the version which is requested by the client. If that is so, then it calls this function to allocate a new session object.
const RMessage2 & aMessage | Connection message, as passed to NewSessionL. |
IMPORT_C void | DoPostHeapMarkOrCheckL | ( | ) | [virtual] |
This function is called just after the heap has either been marked or checked (which is just after DoPreHeapMarkOrCheck).
Typically this function should re-create any objects which had to be freed by DoPreHeapMarkOrCheck.
IMPORT_C void | DoPreHeapMarkOrCheckL | ( | ) | [virtual] |
This function is called just before the SCS framework marks the heap for OOM testing and just before checking the heap.
Typically this function should compact any arrays and free objects which change size and can not be compacted back to the same level.
IMPORT_C void | EnableShutdownTimerL | ( | TInt | aShutdownPeriodUs | ) | [protected] |
Enable shutdown timer support in the server. If there are currently no client sessions the timer will be immediately started, otherwise it will be started when the last client session closes. If the timer expires, before another client creates a session, the server will shutdown. The RScsClientBase::ShutdownServer api will now be supported, if called the server timeout will effectively be reduced to 0.
TInt aShutdownPeriodUs |
CAsyncRequest * | FindAsyncRequest | ( | CScsSession * | aSession, |
CScsSubsession * | aSubsession, | |||
TInt | aFunction | |||
) | [private] |
Find the outstanding request which matches the supplied criteria.
CScsSession * aSession | Session which hosts the request. |
CScsSubsession * aSubsession | Subsession which hosts the request, NULL if the request is relative to a session. |
TInt aFunction | The function identifier, without any SCS code. |
void | IncrementSessionCount | ( | ) |
Record the fact that another session has been created. If this new session is the only session then cancel the shutdown timer.
IMPORT_C CSession2 * | NewSessionL | ( | const TVersion & | aVersion, |
const RMessage2 & | aMessage | |||
) | const [protected, virtual] |
Implement CServer2 by allocating a new session object. This function delegates the actual allocation to the subclass. Before creating the session object, it compares the requested version with its own version. After creating the session object, it increments the session count, which reset the shutdown timer if it is the only session.
TInt | RemoveCompletedRequests | ( | TAny * | aPtr | ) | [private, static] |
This static function is called when iAsyncCleanup runs. It interprets its argument as a pointer to an instance of CScsServer and removes any asynchronous requests which have been completed.
TAny * aPtr | Required callback argument. Interpreted as a pointer to an instance of CScsServer. |
void | RemoveCompletedRequests | ( | ) | [private] |
Delete any asynchronous requests which are marked for deletion.
IMPORT_C void | ShutdownWhenIdleL | ( | ) |
Shutdown immediately when server is next idle. If the server is not transient (ie. has no shutdown timer), this call is prohibited and will leave with KErrNotSupported.
TInt | StripScsFunctionMask | ( | TInt | aFunctionId | ) | [static, inline] |
TInt aFunctionId |
Function ranges to be used when configuring the server security via a CPolicyServer::TPolicy object.
Session/sSubsession function codes will be ORed into the EBaseSession/EBaseSubSession ranges.
Values from EBaseMustAllow, upwards, are used internally and must be allowed.
If there are multiple subsession types (with different function code values), then codes must be be different for each subsession (this restriction only applies if using the CPolicyServer::TPolicy mechanism to configure server security).
WARNNIG: These ranges MUST match the values in scscommon.h TScsFunction.
EBaseSession = 0x01000000 | |
EBaseSubSession = 0x02000000 | |
EBaseMustAllow = 0x03000000 |
CAsyncCallBack * | iAsyncCleanup |
Runs to remove completed requests from iAsyncRequests.
RPointerArray < CAsyncRequest > | iAsyncRequests |
Currently outstanding requests.
CObjectConIx * | iContainerIndex |
Generates instances of CObjectCon , for each session to host its subsessions. Public because must be accessible to session objects.
TInt | iSessionCount | [private] |
Number of open sessions. Used to start and cancel the shutdown timer.
CShutdownTimer * | iShutdownTimer | [private] |
Shutdown timer, started when there are no open sessions, cancelled when the first session is created.
const TVersion | iVersion | [private] |
This server's version. It is compared against client's requested version when the client attempts to make a connection.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.