1.1 --- a/epoc32/include/apaserverapp.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,262 +0,0 @@
1.4 -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -//
1.18 -
1.19 -#ifndef APASERVERAPP_H
1.20 -#define APASERVERAPP_H
1.21 -
1.22 -#include <e32base.h>
1.23 -
1.24 -
1.25 -//
1.26 -// Server application client support
1.27 -//
1.28 -
1.29 -
1.30 -
1.31 -class RApaAppServiceBase : public RSessionBase
1.32 -/** Server app connection and lifetime monitoring functionality.
1.33 -
1.34 -This is the base class for all server application service client
1.35 -support implementations.
1.36 -
1.37 -The class is derived from by the UI framework and is further derived from
1.38 -by service implementations.
1.39 -
1.40 -Clients of these server application services will use these derived classes as
1.41 -the interface to the server application implementations of the services.
1.42 -
1.43 -@publishedPartner
1.44 -@released
1.45 -@see REikAppServiceBase */
1.46 - {
1.47 -public:
1.48 -
1.49 - /** Constants defining the base IPC command ids usable by the system GUI and services. */
1.50 - enum TApaAppServiceBaseCmdConstants
1.51 - {
1.52 - /** System GUI server app command IDs must start from this base. */
1.53 - KSystemGuiCmdBase = 0x100,
1.54 - /** Service specific command IDs must start from this base. */
1.55 - KServiceCmdBase = 0x200
1.56 - };
1.57 -
1.58 -public:
1.59 - IMPORT_C void ConnectExistingAppL(const RApaAppServiceBase& aClient);
1.60 - IMPORT_C void ConnectExistingAppL(const RApaAppServiceBase& aClient, const TSecurityPolicy& aSecurityPolicy);
1.61 - IMPORT_C void ConnectExistingByNameL(const TDesC& aName);
1.62 - IMPORT_C void ConnectExistingByNameL(const TDesC& aServerName, const TSecurityPolicy& aSecurityPolicy);
1.63 - IMPORT_C void TransferExistingSessionL(RApaAppServiceBase& aClient);
1.64 - IMPORT_C void Close(); //lint !e1511 Member hides non-virtual member
1.65 -
1.66 - IMPORT_C void NotifyServerExit(TRequestStatus& aStatus) const;
1.67 - IMPORT_C void CancelNotifyServerExit() const;
1.68 -
1.69 - IMPORT_C TPtrC ServerName() const;
1.70 -
1.71 -protected:
1.72 - IMPORT_C RApaAppServiceBase();
1.73 -
1.74 -private:
1.75 - IMPORT_C virtual void RApaAppServiceBase_Reserved1();
1.76 - IMPORT_C virtual void RApaAppServiceBase_Reserved2();
1.77 -
1.78 - /** Returns the UID of the service that this session provides an interface for.
1.79 - Client side service implementations must implement this function to return
1.80 - the UID for the service that they implement.
1.81 - @return The UID of the service implemented by the derived class.*/
1.82 - virtual TUid ServiceUid() const = 0;
1.83 -
1.84 -private:
1.85 - void ConnectL();
1.86 - void ConnectL(const TSecurityPolicy& aSecurityPolicy);
1.87 -
1.88 -private:
1.89 - IMPORT_C virtual void ExtensionInterface(TUid aInterfaceId, TAny*& aImplementaion);
1.90 -
1.91 -private:
1.92 - HBufC* iServerName; // owned
1.93 - TInt iApaReserved1;
1.94 - TInt iApaReserved2;
1.95 - };
1.96 -
1.97 -
1.98 -class MApaServerAppExitObserver
1.99 -/** Interface for a class that wants to receive exit notification from
1.100 -a server application.
1.101 -
1.102 -@publishedPartner
1.103 -@released
1.104 -@see CApaServerAppExitMonitor*/
1.105 - {
1.106 -public:
1.107 - /** Receives server exit notification.
1.108 - Implementers of this interface must override this function to
1.109 - receive notification of server app exit reasons.
1.110 - @param aReason The reason that the server app exited, this may be
1.111 - a command ID from the UI if exit was triggered from the UI, or an error code
1.112 - if the server app exited unexpectedly. */
1.113 - virtual void HandleServerAppExit(TInt aReason) = 0;
1.114 -protected:
1.115 - IMPORT_C MApaServerAppExitObserver();
1.116 -private:
1.117 - IMPORT_C virtual void MApaServerAppExitObserver_Reserved1();
1.118 - IMPORT_C virtual void MApaServerAppExitObserver_Reserved2();
1.119 -private:
1.120 - TInt iMApaServerAppExitObserver_Reserved1;
1.121 - };
1.122 -
1.123 -
1.124 -class CApaServerAppExitMonitor : public CActive
1.125 -/** Helper class that monitors the lifetime of a server app
1.126 -through a connected RApaAppServiceBase and reports server app exits
1.127 -to a MApaServerAppExitObserver derived class.
1.128 -
1.129 -@publishedPartner
1.130 -@released
1.131 -@see RApaAppServiceBase
1.132 -@see MApaServerAppExitObserver */
1.133 - {
1.134 -public:
1.135 - IMPORT_C static CApaServerAppExitMonitor* NewL(RApaAppServiceBase& aClient, MApaServerAppExitObserver& aObserver, TInt aPriority);
1.136 - IMPORT_C static CApaServerAppExitMonitor* NewLC(RApaAppServiceBase& aClient, MApaServerAppExitObserver& aObserver, TInt aPriority);
1.137 - IMPORT_C ~CApaServerAppExitMonitor();
1.138 -
1.139 -private:
1.140 - CApaServerAppExitMonitor(RApaAppServiceBase& aClient, MApaServerAppExitObserver& aObserver, TInt aPriority);
1.141 -
1.142 -private: // from CActive
1.143 - void RunL();
1.144 - void DoCancel();
1.145 - TInt RunError(TInt aError);
1.146 -
1.147 -private:
1.148 - RApaAppServiceBase& iClient;
1.149 - MApaServerAppExitObserver& iObserver;
1.150 - };
1.151 -
1.152 -
1.153 -//
1.154 -// Server application server support
1.155 -//
1.156 -
1.157 -/** Panic codes that the server application framework can generate.
1.158 -@internalComponent */
1.159 -enum TApaAppServerPanic
1.160 - {
1.161 - /** The IPC message ID used by the client is not recognised. */
1.162 - EApaAppServerPanicIllegalFunction,
1.163 - /** The client already has an active notification of server exit. */
1.164 - EApaAppServerPanicNotifyExitActive,
1.165 - /** The client has tried to connect an already connected session. */
1.166 - EApaAppServerPanicClientAlreadyConnected
1.167 - };
1.168 -
1.169 -
1.170 -class CApaAppServiceBase : public CSession2
1.171 -/** Base class for all service implementations.
1.172 -Provides the basic IPC and security framework that server applications
1.173 -can use to receive messages from their clients.
1.174 -In a typical service implementation, a service support class
1.175 -will be derived from this class, and the service implementation
1.176 -will then be derived from the service support class.
1.177 -
1.178 -Instances of this class are created by the server application
1.179 -in its override of CApaAppServer::CreateServiceL().
1.180 -
1.181 -@publishedPartner
1.182 -@released
1.183 -@see CApaAppServer
1.184 -@see CPolicyServer */
1.185 - {
1.186 -public:
1.187 - IMPORT_C CApaAppServiceBase();
1.188 - IMPORT_C ~CApaAppServiceBase();
1.189 -
1.190 - IMPORT_C virtual CPolicyServer::TCustomResult SecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
1.191 -
1.192 -public: // internal
1.193 - void SendAppServerExitNotification(TInt aExitReason);
1.194 -
1.195 -protected: // from CSession2
1.196 - IMPORT_C void CreateL();
1.197 - IMPORT_C void ServiceL(const RMessage2& aMessage);
1.198 - IMPORT_C void ServiceError(const RMessage2& aMessage,TInt aError);
1.199 - IMPORT_C virtual TInt CountResources();
1.200 - IMPORT_C virtual void Disconnect(const RMessage2& aMessage);
1.201 -
1.202 -private: // Server exit notification handlers
1.203 - void NotifyServerExit(const RMessage2& aMessage);
1.204 - void CancelNotifyServerExit(const RMessage2& aMessage) const;
1.205 -
1.206 -private:
1.207 - IMPORT_C virtual void ExtensionInterface(TUid aInterfaceId, TAny*& aImplementaion);
1.208 - IMPORT_C virtual void CApaAppServiceBase_Reserved1();
1.209 - IMPORT_C virtual void CApaAppServiceBase_Reserved2();
1.210 -
1.211 -private:
1.212 - RMessagePtr2 iNotifyExitMsg;
1.213 - TInt iExitReason;
1.214 - TInt iApaReserved2;
1.215 - };
1.216 -
1.217 -class CApaAppServer : public CPolicyServer
1.218 -/** Base class for all server application's servers.
1.219 -Server applications must derive from this class to implement their
1.220 -servers. These must be instantiated in an override of
1.221 -CApaApplication::NewAppServerL().
1.222 -The main task of this class is to create service implementations
1.223 -that clients of a server app may connect to.
1.224 -
1.225 -@publishedPartner
1.226 -@released
1.227 -@see CEikAppServer
1.228 -@see CPolicyServer */
1.229 - {
1.230 -public:
1.231 - IMPORT_C ~CApaAppServer();
1.232 - IMPORT_C virtual void ConstructL(const TDesC& aFixedServerName);
1.233 -
1.234 - IMPORT_C void NotifyServerExit(TInt aReason);
1.235 -
1.236 - IMPORT_C virtual CApaAppServiceBase* CreateServiceL(TUid aServiceType) const;
1.237 - IMPORT_C virtual TCustomResult CreateServiceSecurityCheckL(TUid aServiceType, const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
1.238 -
1.239 -protected:
1.240 - IMPORT_C CApaAppServer();
1.241 -
1.242 - // From CPolicyServer
1.243 - IMPORT_C TCustomResult CustomSecurityCheckL(const RMessage2& aMsg, TInt& aAction, TSecurityInfo& aMissing);
1.244 - // From CServer2
1.245 - IMPORT_C virtual void DoConnect(const RMessage2& aMessage);
1.246 -
1.247 -private:
1.248 - IMPORT_C CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
1.249 -
1.250 -private:
1.251 - TUid ConnectMessageServiceUid(const RMessage2& aMsg) const;
1.252 -
1.253 -private:
1.254 - IMPORT_C virtual void ExtensionInterface(TUid aInterfaceId, TAny*& aImplementaion);
1.255 - // Extensions
1.256 - IMPORT_C virtual void CApaAppServer_Reserved1();
1.257 - IMPORT_C virtual void CApaAppServer_Reserved2();
1.258 -
1.259 -private:
1.260 - TInt iApaReserved1;
1.261 - TInt iApaReserved2;
1.262 - };
1.263 -
1.264 -
1.265 -#endif