smf/smfservermodule/smfserver/server/smfserver.h
changeset 14 a469c0e6e7fb
parent 13 b5d63d5fc252
child 18 013a02bf2bb0
--- a/smf/smfservermodule/smfserver/server/smfserver.h	Mon Jun 07 11:43:45 2010 +0100
+++ b/smf/smfservermodule/smfserver/server/smfserver.h	Wed Jun 23 19:51:49 2010 +0530
@@ -24,6 +24,7 @@
 #include "smfglobal.h"
 #include "smfprovider.h"
 #include "smftransportmanager.h" // Transport Manager
+#include <SmfCredMgrClientGlobal.h>
 /*
 * Forward declarations
 * Other components of the SMF
@@ -33,7 +34,7 @@
 class SmfDataStoreManager;
 class SmfSettingsAuthManager;
 class SmfClient;
-
+class SmfCredMgrClient;
 //For the time being, need to change later
 typedef QString SmfInterfaceID;
 //For the time being, need to change later
@@ -72,7 +73,7 @@
    *simply return
    *else
    *it'll start the server exe and initialize all other SMF components
-   *returns whether server is started successfully or not  
+   *returns whether server is started successfully or not  
    */
   bool startServer();
   
@@ -80,81 +81,59 @@
 
 public:
   /*
-   * Request the Credential and Settings manager to check whether client has
-   * been authorized previously.
-   * SmfClientAuthID may be same as SID of the client which can be retrieved
-   * if using Symbian Client-Server private implementation. Not supported for
-   * other platforms
-   */
-  bool isClientAuthorized(SmfClientAuthID clientID);
-  
-  /*
-   * In case the client is yet to be authorized, it starts the authorization
-   * process by triggering Credential Manager.
-   * The SLOT clientAuthorizationFinished is called once its done.
-   * SmfClientAuthID may be same as SID of the client which can be retrieved
-   * if using Symbian Client-Server private implementation. Not supported for
-   * other platforms.
-   */
-  void authorizeClient(SmfClientAuthID clientID);
-  
-  /*
    * Requests Plugin Manager to get a list of plugin IDs who implement
    * the interface interfaceID.
-   * This is used got SmfClient::GetServices () where we need a list of plugins
+   * This is used got SmfClient::GetServices () where we need a list of plugins
    */
   void getPlugins(SmfInterfaceID interfaceID, QMap<SmfPluginID,SmfProvider>& pluginIDMap);
   /**
    * Same as above, except this is used for rest of the requests where we need
-   * a particular plugin
+   * a particular plugin
    */
   SmfPluginID getPlugin(SmfInterfaceID interfaceID,SmfProvider provider);
   
   /*
    * Requests the Credential Manager to filter out non-authorized plugin IDs
-   * from the list and get authorized plugins into authList. 
+   * from the list and get authorized plugins into authList. 
    */
   void getAuthorizedPlugins(QList<SmfPluginID>& list,QList<SmfPluginID>& authList);
-  
-  /*
-   * Prepares the transport.
-   * What it'll do is not yet clear
-   */
-  void prepareTransport();
+
   /**
-   * DEbugging purpose only
+   * Request CM API to get the list of authenticated plugins
+   * @see SmfCredMgrClient::authenticatedPluginList()
    */
-  void writeLog(QString log) const;
-  /*
-   * Delegates the request of the client (to get the data from SN sites)
-   * to the Plugin Manager.
-   * Once the Plugin Manager gets parsed response data it calls the SLOT
-   * resultsAvailable(). 
-   * pluginID is the Plugin to be used.
-   * requestTypeID is the function codes(opcodes) used for message passing 
-   * betn clien-server.
-   * Note:- Should there be an overloaded function which takes
-   * list of SmfPluginID ?
-   * Note:- SmfPluginManager will invoke resultsAvailable on session object once
-   * it receives parsed data.
+  QStringList getAuthenticatedPluginList(QString RegistrationToken);
+
+
+  SmfTransportInitializeResult prepareTransport();
+  /**
+   * DEbugging purpose only
    */
+  //void writeLog(QString log) const;
   /**
    * Request the Plugin manager to get the data.
    * @param requestID Corresponds to a client's session
    * @param pluginID Plugin for which the request is intended
    * @param interfaceID Interface name
    * @param dataForPlugin Data to be sent for this request
-   * 
+   * 
    */
-  void getRequestedData(int requestID,SmfPluginID pluginID,SmfInterfaceID interfaceID, SmfRequestTypeID requestTypeID,QByteArray dataForPlugin = QByteArray());
-  
+  void sendToPluginManager(int requestID,SmfPluginID pluginID,SmfInterfaceID interfaceID,SmfRequestTypeID requestTypeID,QByteArray dataForPlugin = QByteArray(), int pageNo=-1,int perpage=-1);
+  /**
+   * Delegates the request to DSM and receives data synshronously.
+   * @param qtdataForDSM Data to be passed to DSM
+   * @param opcode Opcode
+   * @param qtdataFromDSM Data received from DSM
+   * @return Error value returned from DSM
+   */
+  SmfError sendToDSM(QByteArray qtdataForDSM,SmfRequestTypeID opcode,QByteArray& qtdataFromDSM);
 public slots:
 
 	/*
 	 * This slot is called when Credential Manager is done with the autherizing
 	 * the client for the first time. See isClientAuthorized() and authorizeClient().
 	 * success specifies the success of the authorization, authID is the authentication
-	 * ID in case its not same as SID of the client.
+	 * ID in case its not same as SID of the client.
 	 */
 	void clientAuthorizationFinished(bool success,SmfClientAuthID authID );
 
@@ -162,20 +141,20 @@
 	 * This slot is called as a result of trigger from Plugin manager when the 
 	 * parsed data is available.
 	 * @param requestID The request ID for which result is available
-	 * @param parsedData Serialized data
+	 * @param parsedData Serialized data
 	 */
 	void resultsAvailable(int requestID,QByteArray* parsedData,SmfError error);
 
 	/*
 	 * Services the client request by sending the requested data.
-	 * Note:- This will be handled by private implementation.
+	 * Note:- This will be handled by private implementation.
 	 */
 	void serviceClient(QByteArray* parsedData);
 	
 	
 	/*
 	 * This slot is called for every cleanup timer expiry, in this slot, we need
-	 * to call SmfDataStoreManager's API to refresh data store
+	 * to call SmfDataStoreManager's API to refresh data store
 	 */
 	void timerExpired(){};
 	
@@ -183,38 +162,25 @@
 	 * This method is called every time timerExpired slot is trigerred
 	 * Fetches the last saved requests through Transport Manager and Plugin Manager
 	 * Who will save the last request (Tranport Manager or Data Store Manager) TBD later
-	 * 
+	 * 
 	 */
 	void runSavedRequest(){};
 	
 	/*
 	 * This slot is called when the data store updates are available as a result of
 	 * "runSavedRequest()".
-	 * Note:- The "10.4.1.11	updateDatastore" can be merged with this 
+	 * Note:- The "10.4.1.11	updateDatastore" can be merged with this 
 	 */
 	void dataStoreUpdateAvailable(QByteArray* respData){Q_UNUSED(respData)};
 	
 	/**
-	 * Request the CM to get the authentication keys for the given pluginID
-	 */
-	void getAuthenticationKeys(int pluginID,QStringList& keys,QStringList& urls);
-	
-	/**
 	 * Server calls this method when it receives message from the CM
-	 * that authentication keys for the pluginID has expired
+	 * that authentication keys for the pluginID has expired
 	 */
 	void authenticationKeysExpired(NotificationType type,SmfPluginID id);
 signals:
   //None at the moment
 private:
-/*
- * Starts the clean-up timer for data store refresh, called from the "startServer()"
- * timeOutValue should be picked out from SmfSettingsAuthManager's API
- */
-bool startCleanupTimer(int timeOutValue){Q_UNUSED(timeOutValue) return true;};
-
-
-private:
 	//private impl
 #ifdef Q_OS_SYMBIAN
 	SmfServerSymbian* m_SmfServerPrivate;
@@ -227,7 +193,25 @@
 	SmfDataStoreManager* m_dataStoreManager;
 	SmfSettingsAuthManager* m_settingsAuthManager;
 	SmfClient* m_smfClient;
+	SmfCredMgrClient* m_credentialMngr;
 };
-
+#ifdef CLIENT_SERVER_TEST
+class dummyPM : public QObject
+	{
+		Q_OBJECT
+public:
+		dummyPM(SmfServer* server,QObject* parent=0);
+		~dummyPM();
+		SmfError createRequest ( const quint32& aSessionID, 
+				const QString& aPluginID, 
+				const SmfRequestTypeID& aOperation, 
+				QByteArray& aInputData );
+public slots:
+	void responseAvailable();
+private:
+		QTimer* m_timer;
+		SmfServer* m_server;
+	};
+#endif
 
 #endif // SMFSERVER_H