smf/smfservermodule/smfserver/server/smfserver.h
changeset 14 a469c0e6e7fb
parent 13 b5d63d5fc252
child 18 013a02bf2bb0
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
    22 #include<QMap>
    22 #include<QMap>
    23 //SMF wide global const and macros, to be shared among SMF components as well as SMF aware apps
    23 //SMF wide global const and macros, to be shared among SMF components as well as SMF aware apps
    24 #include "smfglobal.h"
    24 #include "smfglobal.h"
    25 #include "smfprovider.h"
    25 #include "smfprovider.h"
    26 #include "smftransportmanager.h" // Transport Manager
    26 #include "smftransportmanager.h" // Transport Manager
       
    27 #include <SmfCredMgrClientGlobal.h>
    27 /*
    28 /*
    28 * Forward declarations
    29 * Forward declarations
    29 * Other components of the SMF
    30 * Other components of the SMF
    30 */
    31 */
    31 class SmfTransportManager;
    32 class SmfTransportManager;
    32 class SmfPluginManager;
    33 class SmfPluginManager;
    33 class SmfDataStoreManager;
    34 class SmfDataStoreManager;
    34 class SmfSettingsAuthManager;
    35 class SmfSettingsAuthManager;
    35 class SmfClient;
    36 class SmfClient;
    36 
    37 class SmfCredMgrClient;
    37 //For the time being, need to change later
    38 //For the time being, need to change later
    38 typedef QString SmfInterfaceID;
    39 typedef QString SmfInterfaceID;
    39 //For the time being, need to change later
    40 //For the time being, need to change later
    40 typedef QString SmfPluginID;
    41 typedef QString SmfPluginID;
    41 //TODO:- define proper enums after consulting with CM owner
    42 //TODO:- define proper enums after consulting with CM owner
    78   
    79   
    79   ~SmfServer();
    80   ~SmfServer();
    80 
    81 
    81 public:
    82 public:
    82   /*
    83   /*
    83    * Request the Credential and Settings manager to check whether client has
       
    84    * been authorized previously.
       
    85    * SmfClientAuthID may be same as SID of the client which can be retrieved
       
    86    * if using Symbian Client-Server private implementation. Not supported for
       
    87    * other platforms
       
    88    */
       
    89   bool isClientAuthorized(SmfClientAuthID clientID);
       
    90   
       
    91   /*
       
    92    * In case the client is yet to be authorized, it starts the authorization
       
    93    * process by triggering Credential Manager.
       
    94    * The SLOT clientAuthorizationFinished is called once its done.
       
    95    * SmfClientAuthID may be same as SID of the client which can be retrieved
       
    96    * if using Symbian Client-Server private implementation. Not supported for
       
    97    * other platforms.
       
    98    */
       
    99   void authorizeClient(SmfClientAuthID clientID);
       
   100   
       
   101   /*
       
   102    * Requests Plugin Manager to get a list of plugin IDs who implement
    84    * Requests Plugin Manager to get a list of plugin IDs who implement
   103    * the interface interfaceID.
    85    * the interface interfaceID.
   104    * This is used got SmfClient::GetServices () where we need a list of plugins
    86    * This is used got SmfClient::GetServices () where we need a list of plugins
   105    */
    87    */
   106   void getPlugins(SmfInterfaceID interfaceID, QMap<SmfPluginID,SmfProvider>& pluginIDMap);
    88   void getPlugins(SmfInterfaceID interfaceID, QMap<SmfPluginID,SmfProvider>& pluginIDMap);
   113   /*
    95   /*
   114    * Requests the Credential Manager to filter out non-authorized plugin IDs
    96    * Requests the Credential Manager to filter out non-authorized plugin IDs
   115    * from the list and get authorized plugins into authList. 
    97    * from the list and get authorized plugins into authList. 
   116    */
    98    */
   117   void getAuthorizedPlugins(QList<SmfPluginID>& list,QList<SmfPluginID>& authList);
    99   void getAuthorizedPlugins(QList<SmfPluginID>& list,QList<SmfPluginID>& authList);
   118   
   100 
   119   /*
   101   /**
   120    * Prepares the transport.
   102    * Request CM API to get the list of authenticated plugins
   121    * What it'll do is not yet clear
   103    * @see SmfCredMgrClient::authenticatedPluginList()
   122    */
   104    */
   123   void prepareTransport();
   105   QStringList getAuthenticatedPluginList(QString RegistrationToken);
       
   106 
       
   107 
       
   108   SmfTransportInitializeResult prepareTransport();
   124   /**
   109   /**
   125    * DEbugging purpose only
   110    * DEbugging purpose only
   126    */
   111    */
   127   void writeLog(QString log) const;
   112   //void writeLog(QString log) const;
   128   /*
       
   129    * Delegates the request of the client (to get the data from SN sites)
       
   130    * to the Plugin Manager.
       
   131    * Once the Plugin Manager gets parsed response data it calls the SLOT
       
   132    * resultsAvailable(). 
       
   133    * pluginID is the Plugin to be used.
       
   134    * requestTypeID is the function codes(opcodes) used for message passing 
       
   135    * betn clien-server.
       
   136    * Note:- Should there be an overloaded function which takes
       
   137    * list of SmfPluginID ?
       
   138    * Note:- SmfPluginManager will invoke resultsAvailable on session object once
       
   139    * it receives parsed data.
       
   140    */
       
   141   /**
   113   /**
   142    * Request the Plugin manager to get the data.
   114    * Request the Plugin manager to get the data.
   143    * @param requestID Corresponds to a client's session
   115    * @param requestID Corresponds to a client's session
   144    * @param pluginID Plugin for which the request is intended
   116    * @param pluginID Plugin for which the request is intended
   145    * @param interfaceID Interface name
   117    * @param interfaceID Interface name
   146    * @param dataForPlugin Data to be sent for this request
   118    * @param dataForPlugin Data to be sent for this request
   147    * 
   119    * 
   148    */
   120    */
   149   void getRequestedData(int requestID,SmfPluginID pluginID,SmfInterfaceID interfaceID, SmfRequestTypeID requestTypeID,QByteArray dataForPlugin = QByteArray());
   121   void sendToPluginManager(int requestID,SmfPluginID pluginID,SmfInterfaceID interfaceID,SmfRequestTypeID requestTypeID,QByteArray dataForPlugin = QByteArray(), int pageNo=-1,int perpage=-1);
   150   
   122   /**
       
   123    * Delegates the request to DSM and receives data synshronously.
       
   124    * @param qtdataForDSM Data to be passed to DSM
       
   125    * @param opcode Opcode
       
   126    * @param qtdataFromDSM Data received from DSM
       
   127    * @return Error value returned from DSM
       
   128    */
       
   129   SmfError sendToDSM(QByteArray qtdataForDSM,SmfRequestTypeID opcode,QByteArray& qtdataFromDSM);
   151 public slots:
   130 public slots:
   152 
   131 
   153 	/*
   132 	/*
   154 	 * This slot is called when Credential Manager is done with the autherizing
   133 	 * This slot is called when Credential Manager is done with the autherizing
   155 	 * the client for the first time. See isClientAuthorized() and authorizeClient().
   134 	 * the client for the first time. See isClientAuthorized() and authorizeClient().
   193 	 * Note:- The "10.4.1.11	updateDatastore" can be merged with this 
   172 	 * Note:- The "10.4.1.11	updateDatastore" can be merged with this 
   194 	 */
   173 	 */
   195 	void dataStoreUpdateAvailable(QByteArray* respData){Q_UNUSED(respData)};
   174 	void dataStoreUpdateAvailable(QByteArray* respData){Q_UNUSED(respData)};
   196 	
   175 	
   197 	/**
   176 	/**
   198 	 * Request the CM to get the authentication keys for the given pluginID
       
   199 	 */
       
   200 	void getAuthenticationKeys(int pluginID,QStringList& keys,QStringList& urls);
       
   201 	
       
   202 	/**
       
   203 	 * Server calls this method when it receives message from the CM
   177 	 * Server calls this method when it receives message from the CM
   204 	 * that authentication keys for the pluginID has expired
   178 	 * that authentication keys for the pluginID has expired
   205 	 */
   179 	 */
   206 	void authenticationKeysExpired(NotificationType type,SmfPluginID id);
   180 	void authenticationKeysExpired(NotificationType type,SmfPluginID id);
   207 signals:
   181 signals:
   208   //None at the moment
   182   //None at the moment
   209 private:
       
   210 /*
       
   211  * Starts the clean-up timer for data store refresh, called from the "startServer()"
       
   212  * timeOutValue should be picked out from SmfSettingsAuthManager's API
       
   213  */
       
   214 bool startCleanupTimer(int timeOutValue){Q_UNUSED(timeOutValue) return true;};
       
   215 
       
   216 
       
   217 private:
   183 private:
   218 	//private impl
   184 	//private impl
   219 #ifdef Q_OS_SYMBIAN
   185 #ifdef Q_OS_SYMBIAN
   220 	SmfServerSymbian* m_SmfServerPrivate;
   186 	SmfServerSymbian* m_SmfServerPrivate;
   221 #else
   187 #else
   225 	SmfTransportManager* m_transportManager;
   191 	SmfTransportManager* m_transportManager;
   226 	SmfPluginManager* m_pluginManager;
   192 	SmfPluginManager* m_pluginManager;
   227 	SmfDataStoreManager* m_dataStoreManager;
   193 	SmfDataStoreManager* m_dataStoreManager;
   228 	SmfSettingsAuthManager* m_settingsAuthManager;
   194 	SmfSettingsAuthManager* m_settingsAuthManager;
   229 	SmfClient* m_smfClient;
   195 	SmfClient* m_smfClient;
       
   196 	SmfCredMgrClient* m_credentialMngr;
   230 };
   197 };
   231 
   198 #ifdef CLIENT_SERVER_TEST
       
   199 class dummyPM : public QObject
       
   200 	{
       
   201 		Q_OBJECT
       
   202 public:
       
   203 		dummyPM(SmfServer* server,QObject* parent=0);
       
   204 		~dummyPM();
       
   205 		SmfError createRequest ( const quint32& aSessionID, 
       
   206 				const QString& aPluginID, 
       
   207 				const SmfRequestTypeID& aOperation, 
       
   208 				QByteArray& aInputData );
       
   209 public slots:
       
   210 	void responseAvailable();
       
   211 private:
       
   212 		QTimer* m_timer;
       
   213 		SmfServer* m_server;
       
   214 	};
       
   215 #endif
   232 
   216 
   233 #endif // SMFSERVER_H
   217 #endif // SMFSERVER_H