syncmlfw/common/sosserver/inc/nsmlsosserver.h
changeset 0 b497e44ab2fc
child 23 4af31167ea77
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Symbian OS server that dispatches SyncML client requests to various engine components. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __NSMLSOSSERVER_H__
       
    20 #define __NSMLSOSSERVER_H__
       
    21 
       
    22 #ifndef SYNCML_V3
       
    23 #define SYNCML_V3
       
    24 #endif
       
    25 
       
    26 // --------------------------------------------------------------------------
       
    27 // Includes
       
    28 // --------------------------------------------------------------------------
       
    29 #include <e32base.h>
       
    30 #include <e32property.h>
       
    31 #include <s32mem.h> 
       
    32 #include <badesca.h>
       
    33 #include <SyncMLClient.h>
       
    34 #include <SyncMLDef.h>
       
    35 #include <SyncMLObservers.h>
       
    36 
       
    37 #include <nsmlconstants.h>
       
    38 #include "NSmlDMAgent.h"
       
    39 #include "NSmlDSAgent.h"
       
    40 
       
    41 #include "nsmldssettings.h"
       
    42 #include "nsmldmsettings.h"
       
    43 
       
    44 #include "nsmlsosserverdefs.h"
       
    45 #include "NSmlAlertQueue.h"
       
    46 
       
    47 #include "nsmlsosthread.h"
       
    48 #include <sbeclient.h>
       
    49 #include <abclient.h>
       
    50 
       
    51  #include <SettingEnforcementInfo.h>
       
    52 class MNSmlSignalHandler;
       
    53 class CNSmlThreadObserver;
       
    54 // --------------------------------------------------------------------------
       
    55 // Panic reasons
       
    56 // --------------------------------------------------------------------------
       
    57 
       
    58 enum TNSmlSOSServerPanic
       
    59     {
       
    60     ECleanupCreateError,
       
    61     EMainSchedulerError
       
    62     };
       
    63 
       
    64 // --------------------------------------------------------------------------
       
    65 // Class forwards
       
    66 // --------------------------------------------------------------------------
       
    67 
       
    68 class CSyncMLFilter;
       
    69 class CNSmlSOSSession;
       
    70 
       
    71 class CNSmlThreadParams;
       
    72 class CNSmlThreadStart;
       
    73 class MNSmlSignalHandler;
       
    74 class CNSmlDSHostClient;
       
    75 class CNSmlDSSettings;
       
    76 
       
    77 /**
       
    78 * Container class for a job progress events that have not
       
    79 * been notified.
       
    80 *
       
    81 *  @since 
       
    82 */
       
    83 struct TNSmlProgressEvent
       
    84     {
       
    85     TNSmlProgressEventType iEventType;
       
    86     MSyncMLProgressObserver::TStatus iProgressStatus;
       
    87     MSyncMLProgressObserver::TErrorLevel iErrorLevel;
       
    88     MSyncMLProgressObserver::TSyncMLDataSyncModifications iClientMods;
       
    89     MSyncMLProgressObserver::TSyncMLDataSyncModifications iServerMods;
       
    90     
       
    91     TInt iInfo1;
       
    92     TInt iInfo2;    
       
    93     TInt iInfo3;
       
    94     TInt iInfo4;
       
    95     };
       
    96 
       
    97 
       
    98 /**
       
    99 * Container class for a job events that have not
       
   100 * been notified (ESmlJobStart, ESmlJobStop).  
       
   101 *
       
   102 *  @since 
       
   103 */
       
   104 struct TNSmlJobEvent
       
   105     {
       
   106     MSyncMLEventObserver::TEvent iEvent;    
       
   107     TInt iEndStatus;
       
   108     TInt iJobId; 
       
   109     TUint dummy;   // not used : to prevent (UDEB) memmove panic                       
       
   110     };
       
   111     
       
   112 /**
       
   113 * Container class for a job created by client.
       
   114 *  Job queue is comprised of CNSmlJob instances.
       
   115 *
       
   116 *  @since 
       
   117 */
       
   118 class CNSmlJob : public CBase
       
   119 	{
       
   120 public:
       
   121        
       
   122 	CNSmlJob();
       
   123 	~CNSmlJob();
       
   124 
       
   125 	TInt JobId() const;
       
   126 	TInt ProfileId() const;
       
   127     TInt CreatorId() const;
       
   128     TInt TransportId() const;
       
   129 	TSmlUsageType UsageType() const;
       
   130     TNSmlJobType JobType() const;
       
   131     TSmlSyncType SyncType() const;
       
   132     void TaskIds( RArray<TInt>& aTasks ) const;
       
   133     const CNSmlSOSSession* OwnerSession() const;
       
   134     CNSmlSOSSession* OwnerSessionNonConst() const;
       
   135 	TBool JobRunning( ) const;
       
   136 
       
   137 	void SetJobId( const TInt aJobId );
       
   138 	void SetProfId( const TInt aProfId );
       
   139     void SetCreatorId( const TInt aCreatorId );
       
   140     void SetTransportId( const TInt aTransportId );
       
   141     void SetUsageType( const TSmlUsageType aUsageType );
       
   142     void SetJobType( const TNSmlJobType aJobType );
       
   143     void SetSyncType( const TSmlSyncType aSyncType );
       
   144     void AddTaskIdL( const TInt aTaskId );
       
   145     void SetOwnerSession( CNSmlSOSSession* aSession );
       
   146  	void SetJobRunning( const TBool aRunning );
       
   147  	void SetJobIapId(const TInt aIapId); 	
       
   148  	TInt GetJobIapId() const;
       
   149 public:
       
   150 	CNSmlJob* iNext;
       
   151     HBufC8* iPackage;
       
   152     TInt iSessionId;
       
   153     CArrayFix<TNSmlContentTypeInfo>* iCtInfo;
       
   154     TBool iPending;
       
   155 	TBool iRunning;
       
   156 	TBool iSilentJob;
       
   157 	TInt iUimode;
       
   158 private:
       
   159     TInt iJobId;
       
   160     TInt iProfId;
       
   161     TInt iCreatorId;
       
   162     TInt iTransportId;
       
   163     RArray<TInt> iTaskIds;
       
   164     TSmlUsageType iUsageType;
       
   165     TNSmlJobType iJobType;
       
   166     TSmlSyncType iSyncType;
       
   167     CNSmlSOSSession* iSession;    
       
   168     TInt iIapId;
       
   169 	};
       
   170 
       
   171 /**
       
   172 * Object for a job sub session.
       
   173 *
       
   174 *  @since 
       
   175 */
       
   176 class CNSmlJobObject : public CObject
       
   177 	{
       
   178 public:
       
   179        
       
   180 	CNSmlJobObject();
       
   181 	~CNSmlJobObject();
       
   182 
       
   183     TInt JobId() const;
       
   184     void SetJobId( const TInt aJobId );
       
   185 
       
   186 private:
       
   187     TInt iJobId;        
       
   188 	};
       
   189 
       
   190 /**
       
   191 * Object for a profile sub session.
       
   192 *  This class is used for reading and updating profile data.
       
   193 *
       
   194 *  @since 
       
   195 */
       
   196 class CNSmlProfile : public CObject
       
   197 	{
       
   198 public:
       
   199     CNSmlProfile( TSmlUsageType aUsageType, CNSmlSOSSession& aSession );
       
   200 	~CNSmlProfile();
       
   201 
       
   202     TInt ProfileId() const;
       
   203     void SetLocked();
       
   204     TBool IsLocked();
       
   205 
       
   206     TInt FetchDataL( const TInt aId, TBool aAllowHidden );
       
   207     void ConnectionListL( RArray<TInt>& aArray );
       
   208     void TaskListL( RArray<TInt>& aArray );
       
   209     
       
   210     TInt DataSize();
       
   211     const TPtr8& ReadData();
       
   212 
       
   213     TInt UpdateDataL( TInt& aId , const TDesC8& aData, TBool& aIsHidden );
       
   214     TBool DeleteTaskL( const TInt aId );
       
   215 
       
   216     void SetCreatorId( const TInt aCreatorId );  
       
   217 
       
   218     TSmlUsageType GetUsageType();
       
   219 private:
       
   220     TInt iProfId;
       
   221     const TSmlUsageType iUsageType;
       
   222     CNSmlSOSSession& iSession;
       
   223     TBool iLocked;
       
   224     TInt iCreatorId;
       
   225 
       
   226     CBufBase* iBuffer;
       
   227     TPtr8 iDataPtr;
       
   228 	};
       
   229 
       
   230 /**
       
   231 * Object for a task sub session.
       
   232 *  This class is used for reading and updating task data.
       
   233 *
       
   234 *  @since 
       
   235 */
       
   236 class CNSmlTask : public CObject
       
   237 	{
       
   238 public:
       
   239 	CNSmlTask( const TInt aProfId, TBool aNewTask, CNSmlSOSSession& aSession );
       
   240 	~CNSmlTask();
       
   241 
       
   242     TInt FetchDataL( const TInt aTaskId );
       
   243     TInt GetSupportedFiltersL();
       
   244 
       
   245     TInt DataSize();
       
   246     const TPtr8& ReadData();
       
   247     TInt FilterSize();
       
   248     const TPtr8& ReadFilter();
       
   249 
       
   250     TInt UpdateDataL( TInt& aId, const TDesC8& aData );
       
   251     
       
   252     void SetCreatorId( const TInt aCreatorId );
       
   253     void SetDataProviderId(  const TInt aTaskUID );
       
   254 
       
   255     TInt PrepareFilterBufferL( const TInt aTaskId );
       
   256     
       
   257 private:
       
   258 	void PackFilterArrayL( RPointerArray<CSyncMLFilter>& aFilterArray, TInt aMatchType , TInt aChangeInfo = 0 );
       
   259 	
       
   260 private:
       
   261     const TInt iProfId;
       
   262     TBool iCreatingNew;
       
   263     CNSmlSOSSession& iSession;
       
   264     
       
   265     TInt iCreatorId;
       
   266     TInt iTaskUID;
       
   267 	
       
   268     CBufBase* iBuffer;    
       
   269     TPtr8 	iDataPtr;   
       
   270     CBufBase* iFilterBuffer;    
       
   271     TPtr8 	iFilterBufPtr;
       
   272 	};
       
   273 
       
   274 /**
       
   275 * Object for a connection sub session.
       
   276 *  This class is used for reading and updating connection data.
       
   277 *
       
   278 *  @since 
       
   279 */
       
   280 class CNSmlConnection : public CObject
       
   281 	{
       
   282 public:
       
   283 	CNSmlConnection( const TInt aProfId, const TInt aTransId, CNSmlSOSSession& aSession );
       
   284 	~CNSmlConnection();
       
   285 
       
   286     TInt FetchDataL();
       
   287 
       
   288     TInt DataSize();
       
   289     const TPtr8& ReadData();
       
   290 
       
   291     TInt UpdateDataL( const TDesC8& aData );
       
   292 
       
   293 private:
       
   294     const TInt iProfId;
       
   295     const TInt iTransId;
       
   296     CNSmlSOSSession& iSession;
       
   297 
       
   298     CBufBase* iBuffer;
       
   299     TPtr8 iDataPtr;
       
   300 	};
       
   301 
       
   302 /**
       
   303 * Object for a history log sub session.
       
   304 *  This class is used for reading and resetting history log data.
       
   305 *
       
   306 *  @since 
       
   307 */
       
   308 class CNSmlHistoryLog : public CObject
       
   309 	{
       
   310 public:
       
   311 	CNSmlHistoryLog( const TInt aProfId, CNSmlSOSSession& aSession );
       
   312 	~CNSmlHistoryLog();
       
   313 
       
   314     TInt FetchDataL();
       
   315 
       
   316     TInt DataSize();
       
   317     const TPtr8& ReadData();
       
   318 
       
   319     void ResetL();
       
   320 
       
   321 private:
       
   322     const TInt iProfId;
       
   323     CNSmlSOSSession& iSession;
       
   324 
       
   325     CBufBase* iBuffer;
       
   326     HBufC8* iData;
       
   327     TPtr8 iDataPtr;
       
   328 	};
       
   329 
       
   330 /**
       
   331 * Object for a data provider sub session.
       
   332 *  This class is used for reading data provider data.
       
   333 *
       
   334 *  @since 
       
   335 */
       
   336 class CNSmlDataProvider : public CObject
       
   337 	{
       
   338 public:
       
   339 	CNSmlDataProvider( const TInt aId, CNSmlSOSSession& aSession );
       
   340 	~CNSmlDataProvider();
       
   341 
       
   342     void FetchDataL();
       
   343 
       
   344     TInt DataSize();
       
   345     const TPtr8& ReadData();
       
   346 
       
   347 private:
       
   348     const TInt iId;
       
   349 
       
   350     CBufBase* iBuffer;
       
   351     TPtr8 iDataPtr;
       
   352     CNSmlSOSSession& iSession;
       
   353 	};
       
   354 
       
   355 /**
       
   356 * An active class for handling jobs, queuing and outstanding event and progress requests.
       
   357 *  This class also keeps record of connected clients and closes server when it is not used.
       
   358 *
       
   359 *  @since 
       
   360 */
       
   361 class CNSmlSOSHandler : public CActive, public MSyncMLProgressObserver, MNSmlAlertObserver 
       
   362 	{
       
   363 public:
       
   364     static CNSmlSOSHandler* NewL();
       
   365     ~CNSmlSOSHandler();
       
   366 
       
   367     void LockProfile( const TInt aProfId );
       
   368     void RemoveLock( const TInt aProfId );
       
   369     TBool IsLocked( const TInt aProfId );
       
   370 
       
   371     TInt AddJobL( CNSmlJob* aJob, TInt& aJobId );
       
   372     CNSmlJob* FindJob( TInt aJobId );
       
   373     TInt StopJob( const TInt aJobId, const TInt aCreatorId );
       
   374     void CurrentJob( TInt& aId, TSmlUsageType& aType );
       
   375     void QueuedJobsL( RArray<TInt>& aArray, const TSmlUsageType aType );
       
   376 
       
   377     void AddProgressMsgL( const RMessage2& aMessage );
       
   378     void AddContactSuiteProgressMsgL( const RMessage2& aMessage );
       
   379     TBool CompleteBufProgressMsg( const TDesC8& aBuf, const CNSmlSOSSession* aSession );
       
   380 	TBool CompleteBufContactSuiteProgressMsg( const TDesC8& aBuf, const CNSmlSOSSession* aSession );
       
   381     void CancelProgressMsg( const CNSmlSOSSession* aSession );
       
   382     void CancelContactSuiteProgressMsg( const CNSmlSOSSession* aSession );
       
   383 
       
   384     void AddEventMsgL( const RMessage2& aMessagePtr );
       
   385     void CancelEventMsg( TInt aHandle );
       
   386     void CompleteEventMsgL( MSyncMLEventObserver::TEvent aEvent, TInt aId = 0, TInt aError = 0, TInt aAdditional = 0 );
       
   387 
       
   388     void ServerAlertL( TDesC8& aData, TSmlUsageType aType, TSmlProtocolVersion aVersion, TSmlTransportId aBearerType );
       
   389     
       
   390     // FOTA
       
   391     void GenericAlertL( HBufC8* aMgmtUri, HBufC8* aMetaType, HBufC8* aMetaFormat, TInt aFinalResult, HBufC8* aCorrelator );
       
   392 	// FOTA end
       
   393     void GenericAlertL( HBufC8* aCorrelator, RArray<CNSmlDMAlertItem>* aItem  );
       
   394 	
       
   395     void IncreaseSessionCount();
       
   396     void DecreaseSessionCount();
       
   397 
       
   398     void ServerSuspendedL( const TBool aSuspended );
       
   399     TBool IsSuspended();
       
   400     void ClearSessionFromJob( const CNSmlSOSSession* aSession );
       
   401     void ClosePendingMessages( const CNSmlSOSSession* aSession );
       
   402     
       
   403     void RegisterContactSuiteObserversWithProfileId(TInt aProfileId);
       
   404     TInt GetContactSuiteRegisteredProfileId() 
       
   405         {
       
   406         return iContactSuiteObserverProfileId;
       
   407         }
       
   408     TInt GetCurrentOngoingSessionProfileId()
       
   409         {
       
   410         if( iCurrentJob != NULL )
       
   411             return iCurrentJob->ProfileId();
       
   412         else
       
   413             return 0;
       
   414         }
       
   415     
       
   416 public:
       
   417     // from MNSmlAlertObserver
       
   418 	void CreateJobL( CNSmlAlertJobInfo& aJobInfo );
       
   419 	void DoDisconnectL();	
       
   420 
       
   421     // from MSyncMLProgressObserver
       
   422     void OnSyncMLSyncError( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 );
       
   423     void OnSyncMLSyncProgress( TStatus aStatus, TInt aInfo1, TInt aInfo2 );		
       
   424     void OnSyncMLDataSyncModifications( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods,
       
   425                                                       const TSyncMLDataSyncModifications& aServerMods );
       
   426 public:
       
   427 
       
   428 	HBufC8* WriteSyncErrorL( TErrorLevel aErrorLevel, TInt aError, TInt aTaskId, TInt aInfo1, TInt aInfo2 );
       
   429 	HBufC8* WriteSyncProgressL( TStatus aStatus, TInt aInfo1, TInt aInfo2 );
       
   430 	HBufC8* WriteSyncModificationsL( TInt aTaskId, const TSyncMLDataSyncModifications& aClientMods,
       
   431                                                    const TSyncMLDataSyncModifications& aServerMods );
       
   432                                                      
       
   433 private:
       
   434     CNSmlSOSHandler();
       
   435     void ConstructL();
       
   436 
       
   437     TInt CreateJobId();
       
   438 
       
   439     void StartDSSyncL();
       
   440     void CancelDSSync();
       
   441     void StartDMSyncL();
       
   442     void CancelDMSync();
       
   443 
       
   444     void FinishCurrentJobL();
       
   445 
       
   446     TBool SearchSimilarJobs( const CNSmlJob* aJob );
       
   447     void ReadTasksFromDBL( RArray<TInt>& aArray );
       
   448     TSmlSyncType ReadSyncTypeForTaskL( const TInt aTaskId );
       
   449     void HandleEventMsg( MSyncMLEventObserver::TEvent, TInt status = 0 );
       
   450 
       
   451 	CNSmlDbCaps::ENSmlSyncTypes ConvertSyncTypes(TSmlSyncType aSyncType);
       
   452     // from CActive
       
   453     void DoCancel();
       
   454     void RunL();
       
   455 
       
   456 private:
       
   457     RArray<RMessage2> iProgressMsgs;
       
   458     RArray<RMessage2> iEventMsgs;
       
   459     RArray<RMessage2> iContactSuiteProgressMsgs;
       
   460     
       
   461     RArray<TInt> iProfileLocks;
       
   462 
       
   463 	CNSmlJob* iCurrentJob;
       
   464     TInt iJobIndex;
       
   465     TInt iContactSuiteObserverProfileId;    
       
   466 
       
   467     RDesWriteStream iWrtStream;
       
   468     
       
   469     CNSmlMessageQueue* iMsgQueue;
       
   470 	RLibrary iSessionLib;
       
   471     TInt iSessionCount;	
       
   472 
       
   473     TBool iSuspended;
       
   474 	
       
   475 	CNSmlThreadParams *iParams;
       
   476 	CNSmlThreadObserver* iThreadObserver;
       
   477 	};
       
   478 
       
   479 /**
       
   480 * An active class to follow system backup and restore state.
       
   481 *  This class informs handler to suspend server when needed.
       
   482 *
       
   483 *  @since 
       
   484 */
       
   485 class CNSmlSOSBackup : public CActive
       
   486 	{
       
   487 public:
       
   488     static CNSmlSOSBackup* NewL( CNSmlSOSHandler* aHandler );
       
   489 	~CNSmlSOSBackup();
       
   490 
       
   491     void Subscribe();
       
   492 
       
   493 private:    
       
   494 	CNSmlSOSBackup( CNSmlSOSHandler* aHandler );
       
   495     void ConstructL();
       
   496     
       
   497     void RunL();
       
   498     void DoCancel();
       
   499 
       
   500 	void BackUpModeL();
       
   501 	void DeleteDataInRestoreL();
       
   502 private:
       
   503     CNSmlSOSHandler* iHandler;
       
   504     RProperty iProperty;
       
   505     TBool iRestoring;
       
   506 	};
       
   507 
       
   508 /**
       
   509 * A server class to intialize server and create sessions. 
       
   510 *
       
   511 *  @since 
       
   512 */
       
   513 class CNSmlSOSServer : public CServer2
       
   514 	{
       
   515 public:
       
   516     static void PanicServer( TNSmlSOSServerPanic aPanic );
       
   517     static TInt ThreadFunction( TAny* aStarted );
       
   518 
       
   519     static CNSmlSOSServer* NewL();
       
   520 	~CNSmlSOSServer();
       
   521    
       
   522 public:
       
   523     CSession2* NewSessionL( const TVersion& aVersion, const RMessage2& aMessage ) const;
       
   524 	CObjectCon* NewContainerL();
       
   525 
       
   526 private:    
       
   527 	CNSmlSOSServer();
       
   528     void ConstructL();
       
   529 
       
   530 private:
       
   531     CNSmlSOSHandler* iHandler;
       
   532     CObjectConIx* iObjConIndex;
       
   533     mutable CNSmlSOSBackup* iBackup;
       
   534 	};
       
   535 
       
   536 /**
       
   537 * A session class to manage and deliver messages from client.
       
   538 *  This class creates and closes sub sessions.
       
   539 *
       
   540 *  @since 
       
   541 */
       
   542 class CNSmlSOSSession : public CSession2
       
   543 	{
       
   544 public:
       
   545 	static CNSmlSOSSession* NewL( CNSmlSOSServer* aServer, CNSmlSOSHandler* aHandler );
       
   546 	void ServiceL( const RMessage2 &aMessage );
       
   547     void DispatchMessageL( const RMessage2 &aMessage );
       
   548 
       
   549     void StoreToEventBuffer( MSyncMLEventObserver::TEvent aEvent, TInt aJobId, TInt aStatus );
       
   550     void StoreToProgessEventBuffer( const TNSmlProgressEvent& aProgressEventItem );
       
   551     
       
   552     CNSmlDSSettings& DSSettings();
       
   553     CNSmlDMSettings& DMSettings();
       
   554     CNSmlDSHostClient& HostClient();
       
   555     
       
   556     TBool ProgressEventsBuffered();
       
   557 private:	
       
   558 	    
       
   559     // event request
       
   560     void StartEventRequest( const RMessage2& aMessage );
       
   561     void CancelEventRequest( const RMessage2& aMessage );
       
   562     
       
   563     // progress event request
       
   564     void StartProgressRequest( const RMessage2& aMessage );
       
   565     void CancelProgressRequest( const RMessage2& aMessage );
       
   566 
       
   567     // client session 
       
   568     void CurrentJobL( const RMessage2& aMessage );
       
   569     void QueuedJobsL( const RMessage2& aMessage );
       
   570     void ProfileListL( const RMessage2& aMessage );
       
   571     void PackIntDataL( const RMessage2& aMessage );
       
   572     void DeleteProfileL( const RMessage2& aMessage );
       
   573     
       
   574     // job
       
   575     void CreateJobL( const TNSmlJobType aJobType, const RMessage2& aMessage );     
       
   576     void OpenJobL( const RMessage2& aMessage ); 
       
   577     void GetJobL( const RMessage2& aMessage );   
       
   578     void StopJob( const RMessage2& aMessage );
       
   579     void CloseJobL( const RMessage2& aMessage );
       
   580 	CNSmlJobObject* JobFromHandle( TUint aHandle );
       
   581 	void CheckJobDataL( CNSmlJob* aJob );
       
   582 	
       
   583     // profile
       
   584     void CreateProfileL( const RMessage2& aMessage, const TSmlUsageType aUsageType );
       
   585     void OpenProfileL( const RMessage2& aMessage, const TSmlUsageType aUsageType );
       
   586     void GetProfileL( const RMessage2& aMessage );
       
   587     void ConnectionListL( const RMessage2& aMessage );
       
   588     void TaskListL( const RMessage2& aMessage );
       
   589     void DeleteTaskL( const RMessage2& aMessage );
       
   590     void SetProfileL( const RMessage2& aMessage );
       
   591     void CloseProfile( const RMessage2& aMessage );
       
   592     CNSmlProfile* ProfileFromHandle( TUint aHandle );
       
   593     
       
   594     // task
       
   595     void CreateTaskL( const RMessage2& aMessage );
       
   596     void OpenTaskL( const RMessage2& aMessage );
       
   597     void GetTaskL( const RMessage2& aMessage );
       
   598     void OpenTaskSupportedFiltersL( const RMessage2& aMessage );
       
   599     void GetTaskSupportedFiltersL( const RMessage2& aMessage );
       
   600     void SetTaskL( const RMessage2& aMessage );
       
   601     void CloseTaskL( const RMessage2& aMessage );
       
   602     CNSmlTask* TaskFromHandle( TUint aHandle );
       
   603 
       
   604     // connection
       
   605     void OpenConnectionL( const RMessage2& aMessage );
       
   606     void GetConnectionL( const RMessage2& aMessage );
       
   607     void SetConnectionL( const RMessage2& aMessage );
       
   608     void CloseConnectionL( const RMessage2& aMessage );
       
   609     CNSmlConnection* ConnectionFromHandle( TUint aHandle );
       
   610 
       
   611     // history log
       
   612     void OpenHistoryLogL( const RMessage2& aMessage );
       
   613     void GetHistoryLogL( const RMessage2& aMessage );
       
   614     void ResetHistoryLogL( const RMessage2& aMessage );
       
   615     void CloseHistoryLogL( const RMessage2& aMessage );
       
   616     CNSmlHistoryLog* HistoryLogFromHandle( TUint aHandle );
       
   617 
       
   618     // data provider
       
   619     void OpenDataProviderL( const RMessage2& aMessage );
       
   620     void GetDataProviderL( const RMessage2& aMessage );
       
   621     void CloseDataProviderL( const RMessage2& aMessage );
       
   622     CNSmlDataProvider* DataProviderFromHandle( TUint aHandle );
       
   623 
       
   624     void ServerAlertL( const RMessage2& aMessage );
       
   625     void InitDMAuthInfoL( const RMessage2& aMessage );
       
   626     void GetDMAuthInfoL( const RMessage2& aMessage );
       
   627     void SetDMAuthInfoL( const RMessage2& aMessage );
       
   628     
       
   629     TBool CheckSettingEnforcementStateL( const RMessage2& aMessage, 
       
   630             KSettingEnforcements aSetting );
       
   631     // FOTA
       
   632 	void AddDMGenericAlertL( const RMessage2& aMessage );
       
   633 	// FOTA end
       
   634 	void AddGenericAlertL( const RMessage2& aMessage );
       
   635 private:
       
   636 
       
   637 	TBool MessageFromDMServer( const RMessage2& aMessage );
       
   638     void CompleteBufferedEventL();
       
   639     void CompleteBufferedProgressEventL();
       
   640 	void CompleteBufferedContactSuiteProgressEventL();
       
   641     void BufferDoModifications( const TNSmlProgressEvent& aProgressEventItem );
       
   642     void BufferContactSuiteDoModifications( const TNSmlProgressEvent& aProgressEventItem );
       
   643 	void ConstructL();
       
   644 	CNSmlSOSSession( CNSmlSOSServer* aServer, CNSmlSOSHandler* aHandler );
       
   645 	~CNSmlSOSSession(); // used by CSession2 -> private.
       
   646 	
       
   647 private:
       
   648     CNSmlSOSServer* iServer;
       
   649     CNSmlSOSHandler* iHandler;
       
   650   
       
   651     CObjectCon* iObjCon;  // Contains all the pointers to CObject classes (SubSessions).
       
   652     CObjectIx* iObjIndex; // Used to find the object from handle.
       
   653 
       
   654     RArray<TInt> iArray; // This array keeps TInt data for ..ListStart and ..ListNext commands use.
       
   655     TInt iArrayIndex;    // This index indicates the next object in array to be packed.
       
   656     
       
   657     TInt iEventMsgHandle;
       
   658 
       
   659     RArray<TNSmlJobEvent> iEventBuffer;  //Job event buffer  
       
   660     RArray<TNSmlProgressEvent>  iProgressEventBuffer;    
       
   661 	RArray<TNSmlProgressEvent>  iContactSuiteProgressEventBuffer;    
       
   662     CBufBase* iDMAuthInfo;  
       
   663     CNSmlDSHostClient* iDsClient;
       
   664     CNSmlDSSettings* iDSSettings;      
       
   665     CNSmlDMSettings* iDMSettings;   
       
   666 	};
       
   667 
       
   668 TInt LaunchServer();
       
   669 
       
   670 #endif // __NSMLSESSIONSERVER_H__