webservices/wsconnection/inc/senserviceconnectionimpl.h
changeset 0 62f9d29f7211
equal deleted inserted replaced
-1:000000000000 0:62f9d29f7211
       
     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:        Custom plug-in implementations offer their own API documentation
       
    15 *                where detailed characteristics about how methods declared in this
       
    16 *                class are implemented.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 #ifndef SEN_SERVICE_CONNECTION_IMPL_H
       
    28 #define SEN_SERVICE_CONNECTION_IMPL_H
       
    29 
       
    30 // INCLUDES
       
    31 #include <flogger.h>
       
    32 #include <e32property.h>
       
    33 
       
    34 #include "sendebug.h"
       
    35 
       
    36 #include "SenServiceConnection.h"
       
    37 #ifdef __ENABLE_ALR__
       
    38 	#include "senserviceconnectioninterfaces.h"
       
    39 #endif //__ENABLE_ALR__
       
    40 #include "seninternalserviceconnectioninterfaces.h"
       
    41 
       
    42 #include "MSenServiceDescription.h"
       
    43 #include "rsenserviceconnection.h"
       
    44 #include "senpointermap.h"
       
    45 #include "SenHttpTransportProperties.h"
       
    46 
       
    47 #include "msencobrandinginterface.h"
       
    48 
       
    49 #include "senservicedispatcher.h"
       
    50 #include "senregistrationtimer.h"
       
    51 
       
    52 // CONSTANTS
       
    53 _LIT8(KServiceConnectionElementLocalName, "ServiceConnection");
       
    54 
       
    55 // FORWARD DECLARATIONS
       
    56 class CSenConnectionChunk;
       
    57 class CSenAsyncOperation;
       
    58 class CSenConnectionStatusObserver;
       
    59 class CSenFileProgressObserver;
       
    60 class CSenBinaryContainer;
       
    61 class RProperty;
       
    62 
       
    63 // TYPEDEFS
       
    64 typedef RSenPointerMap<TInt, CSenConnectionChunk> RChunkMap;
       
    65 typedef RSenPointerMap<TDesC8, CSenBinaryContainer> RBinaryMap;
       
    66 typedef RArray<TXmlEngDataContainer> RDataContainerArray;
       
    67 typedef RSenPointerMap<TInt, RDataContainerArray> RDataContainerMap;
       
    68 
       
    69 // CLASS DECLARATION
       
    70 
       
    71 /**
       
    72 * Custom plug-in implementations offer their own API documentation
       
    73 * where detailed characteristics about how methods declared in this
       
    74 * class are implemented.
       
    75 */
       
    76 #ifdef __ENABLE_ALR__
       
    77 	class CSenServiceConnectionImpl : public CSenServiceConnection, MSenInternalServiceConnection, MSenAlrServiceConnection, MSenRegistrationActor
       
    78 #else
       
    79 	class CSenServiceConnectionImpl : public CSenServiceConnection, MSenInternalServiceConnection, MSenRegistrationActor
       
    80 #endif //__ENABLE_ALR__
       
    81     {
       
    82         friend class CSenAsyncOperation;
       
    83         friend class CSenUnderTakerWaiter;        
       
    84     public:
       
    85 
       
    86         // Constructors and destructor:
       
    87         static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aObserver,
       
    88                                                 const TDesC8& aUri);
       
    89 
       
    90         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aObserver,
       
    91                                                 const TDesC8& aUri);
       
    92 
       
    93         static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aObserver,
       
    94                                     MSenServiceDescription& aServiceDescription);
       
    95 
       
    96         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aObserver,
       
    97                                     MSenServiceDescription& aServiceDescription);
       
    98 
       
    99         static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aObserver,
       
   100                                     CSenServicePattern& aServicePattern);
       
   101 
       
   102         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aObserver,
       
   103                                     CSenServicePattern& aServicePattern);
       
   104 
       
   105 		static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aConsumer,
       
   106                                                const TDesC8& aContract,
       
   107                                                MSenExtendedConsumerInterface& aExtendedConsumer);
       
   108 
       
   109         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aConsumer,
       
   110                                                 const TDesC8& aContract,
       
   111                                                 MSenExtendedConsumerInterface& aExtendedConsumer);
       
   112 
       
   113         static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aConsumer,
       
   114                                                MSenServiceDescription& aServiceDescription,
       
   115                                                MSenExtendedConsumerInterface& aExtendedConsumer);
       
   116 
       
   117         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aConsumer,
       
   118                                                 MSenServiceDescription& aServiceDescription,
       
   119                                                 MSenExtendedConsumerInterface& aExtendedConsumer);
       
   120 
       
   121         static CSenServiceConnectionImpl* NewL(MSenServiceConsumer& aConsumer,
       
   122                                                CSenServicePattern& aServicePattern,
       
   123                                                MSenExtendedConsumerInterface& aExtendedConsumer);
       
   124 
       
   125         static CSenServiceConnectionImpl* NewLC(MSenServiceConsumer& aConsumer,
       
   126                                                 CSenServicePattern& aServicePattern,
       
   127                                                 MSenExtendedConsumerInterface& aExtendedConsumer);
       
   128         // Opens connection to WSF Symbian Server
       
   129         void ConnectL();  
       
   130         
       
   131         void SetConsumer( MSenServiceConsumer& aConsumer, MSenExtendedConsumerInterface* apExtConsumer = NULL );
       
   132         void Consumer( MSenServiceConsumer*& aConsumer, MSenExtendedConsumerInterface*& apExtConsumer );
       
   133 
       
   134         virtual ~CSenServiceConnectionImpl();
       
   135 
       
   136         // New functions:
       
   137         virtual TInt SendL(const TDesC8& aRequest);
       
   138         virtual TInt SubmitL(const TDesC8& aRequest, HBufC8*& aResponse);
       
   139         virtual TInt CompleteServerMessagesOnOff(const TBool& aCompleteOnOff);
       
   140         virtual TInt HasFacetL(const TDesC8& aURI, TBool& aHasFacet);
       
   141         virtual TInt IsReady(TBool& aReady);
       
   142         virtual TInt SendL(RFile& aFile);
       
   143         virtual TInt SubmitL(RFile& aFileHandle, HBufC8*& aResponse);
       
   144 //        virtual TBool IsServChunkSlotAvailable();
       
   145         virtual TInt SendL(CSenSoapEnvelope& aMessage);
       
   146         virtual TInt SubmitL(CSenSoapEnvelope& aMessage, HBufC8*& aResponseTo);
       
   147 
       
   148         virtual TInt ServiceDescriptionL(HBufC8*& aServiceDescription);
       
   149         virtual TInt StartTransaction();
       
   150         virtual TInt TransactionCompleted();
       
   151         virtual TInt CancelAllRequests();
       
   152 
       
   153         virtual void WriteStartElementL( const TDesC8& aNsUri,
       
   154                                          const TDesC8& aLocalName,
       
   155                                          const TDesC8& aQName,
       
   156                                          const RAttributeArray& aAttributes);
       
   157 
       
   158         virtual void WriteEndElementL(const TDesC8& aNsUri,
       
   159                                       const TDesC8& aLocalName,
       
   160                                       const TDesC8& aQName);
       
   161 
       
   162         virtual const TDesC8& LocalName() const;
       
   163         virtual const TDesC8& NsUri() const;
       
   164         virtual const TDesC8& NsPrefix() const;
       
   165         virtual void WriteAsXMLToL(RWriteStream& aWriteStream);
       
   166         virtual HBufC* AsXmlUnicodeL();
       
   167         virtual HBufC8* AsXmlL();
       
   168         virtual TBool ConsistsOfL(MSenFragment& aCandidate);
       
   169 
       
   170         // Functions from base classes
       
   171 
       
   172         // from MSenFragment
       
   173         /**
       
   174         * @return the current object as element.
       
   175         *          Retains ownership.
       
   176         */
       
   177         virtual CSenElement& AsElement();
       
   178 
       
   179         /**
       
   180         * @return the current object as element. May return NULL.
       
   181         *          Caller takes ownership.
       
   182         */
       
   183         virtual CSenElement* ExtractElement();
       
   184 
       
   185         virtual void SetReader(CSenXmlReader& aReader);
       
   186         virtual CSenXmlReader* Reader();
       
   187 
       
   188         /**
       
   189         * SetReader() must be called before this method can be used.
       
   190         */
       
   191         virtual void ParseL(const TDesC8& aBuf);
       
   192 
       
   193         /**
       
   194         * Same as ParseL() except that it takes 16-bit input and does silently
       
   195         * fail in case of all errors.
       
   196         * SetReader() must be called before this method can be used.
       
   197         * @return error code, if any.
       
   198         */
       
   199         virtual TInt BuildFrom(const TDesC8& aBuf);
       
   200 
       
   201         /**
       
   202         * Let the delegate CSenFragment handle with SAX events.
       
   203         * "this" CSenFragment is made the owner of the delegate and
       
   204         * the delegate is expected to make this CSenFragment the receiver
       
   205         * of SAX events once it has seen the end element for itself.
       
   206         */
       
   207         virtual void DelegateParsingL(MSenFragment& aDelegate);
       
   208 
       
   209         /**
       
   210         * Let a new CSenFragment for a new CSenBaseElement with the given
       
   211         * namespace and name handle SAX events. The new MSenElement is made
       
   212         * a child of the MSenElement of this CSenFragment.
       
   213         */
       
   214         virtual void DelegateParsingL(  const TDesC8& aNsUri,
       
   215                                         const TDesC8& aLocalName,
       
   216                                         const TDesC8& aQName,
       
   217                                         const RAttributeArray& aAttributes);
       
   218 
       
   219         virtual void ParseWithL(CSenXmlReader& aReader);
       
   220         virtual void SetOwner(MSenFragment& aFragment);
       
   221         virtual void ResumeParsingFromL( const TDesC8& aNsUri,
       
   222                                          const TDesC8& aLocalName,
       
   223                                          const TDesC8& aQName );
       
   224 
       
   225         virtual void SetAttributesL(const RAttributeArray& aAttributes);
       
   226         virtual TInt TxnId();
       
   227         virtual MSenMessage* Response();
       
   228         virtual TInt CancelTransaction(TInt aTransactionID);
       
   229         virtual TInt SetTransportPropertiesL(const TDesC8& aProperties);
       
   230         virtual TInt TransportPropertiesL(HBufC8*& aProperties);
       
   231         virtual TInt SendL(const TDesC8& aRequest, const TDesC8& aProperties);
       
   232         virtual TInt SendL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties);
       
   233         virtual TInt SubmitL(CSenSoapEnvelope& aMessage, const TDesC8& aProperties, HBufC8*& aResponseTo);
       
   234         virtual TInt SubmitL(const TDesC8& aRequest, const TDesC8& aProperties, HBufC8*& aResponse);
       
   235         virtual TInt AssignMessageToChunkL(CSenChunk& aChunk, MSenMessage& aMessage);	//codescannerwarnings
       
   236         virtual TInt SendL(MSenMessage& aMessage);
       
   237         virtual TInt SubmitL(MSenMessage& aMessage, CSenSoapEnvelope2*& aResponseTo);
       
   238         virtual TInt IdentityProviderL(CSenIdentityProvider*& apIdentityProvider);
       
   239         virtual TInt Identifier();
       
   240 		
       
   241 				virtual void DataTrafficDetails( TSenDataTrafficDetails& aDetails,
       
   242 										 TSenDataTrafficOperations& aOperations );
       
   243 										 
       
   244 
       
   245 
       
   246 #ifdef __ENABLE_ALR__
       
   247     	virtual void MigrateToPrefferedCarrierL(TBool &aUserChoice) ;
       
   248 			virtual void NewCarrierAcceptedL(TBool &aUserChoice) ;		
       
   249 #endif
       
   250       virtual TInt PendingTrasanctionsCount();
       
   251       
       
   252       // From MSenInternalServiceConnection
       
   253 			/**
       
   254         * Sends information about BLOB transfer progres to hostlet.
       
   255         *
       
   256         * @param aTxnId Transaction ID.
       
   257         * @param aIncoming ETrue if it is incoming BLOB, EFalse if outgoing.
       
   258         * @param aMessage SOAP message for incoming messages with BLOBs.
       
   259         * @param aCid CID of current BLOB.
       
   260         * @param aProgress Count of sent/received BLOB bytes.
       
   261         */
       
   262         virtual TInt SendProgressToHostlet(TInt aTxnId, TBool aIncoming, const TDesC8& aMessage, const TDesC8& aCid, TInt aProgress);
       
   263         
       
   264         TPtrC8 InitDescription();
       
   265         
       
   266     protected: // Functions from base classes
       
   267 
       
   268         // from CActive
       
   269         void RunL();
       
   270         void DoCancel();
       
   271 
       
   272     private:
       
   273 
       
   274         /**
       
   275         * C++ default constructor.
       
   276         */
       
   277         CSenServiceConnectionImpl(MSenServiceConsumer& aObserver,
       
   278                                   MSenExtendedConsumerInterface* aExtendedConsumerInteface);
       
   279 
       
   280         /**
       
   281         * By default Symbian 2nd phase constructor is private.
       
   282         */
       
   283         void ConstructL(MSenServiceDescription& aPattern);
       
   284 
       
   285         // New functions
       
   286         TInt SendL(CSenSoapEnvelope2& aMessage);
       
   287 
       
   288         TInt SubmitL(CSenSoapEnvelope2& aMessage, CSenSoapEnvelope2*& aResponseTo);
       
   289 
       
   290 
       
   291         TInt SendL(CSenConnectionChunk* aClientOp);
       
   292 
       
   293         TInt SubmitL(CSenConnectionChunk& aClientOp);
       
   294 
       
   295         TInt ResponseFromChunk(CSenChunk& aClientOp, HBufC8*& aResponseTo);
       
   296 
       
   297         TInt SubmitL(CSenConnectionChunk& aClientOp, CSenSoapEnvelope2*& aResponseTo);
       
   298 
       
   299         TInt CheckConnection();
       
   300 
       
   301         void InitializeL( /*MSenServiceDescription& aPattern */ );
       
   302 
       
   303         void DeliverResponseL(const TInt aErrorCode, CSenChunk* apOperation = NULL);
       
   304 
       
   305         RChunkMap& ChunkMapL();
       
   306 
       
   307         TPtrC SessionID();
       
   308 
       
   309         TPtrC NextChunkName();
       
   310 
       
   311         RPointerArray<CSenAsyncOperation>& AsyncOpsArrayL();	//codescannerwarnings
       
   312 
       
   313         void HandleMessageFromChildAOL(TInt aStatus);
       
   314 
       
   315         TInt AssignPropertiesToChunkL(CSenChunk& aChunk, CSenSoapEnvelope& aMessage,
       
   316                                      const TDesC8& aProperties = KNullDesC8);	////codescannerwarnings
       
   317 
       
   318         TInt MoveBinaryContainersToServer(CSenConnectionChunk& aOperation,
       
   319                                           RArray<TXmlEngDataContainer>& aList);
       
   320 		TInt MoveFileChunkHandleToServer(CSenConnectionChunk& aOperation);
       
   321 
       
   322 
       
   323         RFileLogger* Log() const;
       
   324 
       
   325         void DeliverStatus(TInt aStatus);
       
   326 
       
   327         /*
       
   328         * Method gets the Http method from the transport properties
       
   329         * @param aProperties contains the transport properties in serialized (UTF-8) form.
       
   330         * @param aMethod A TSenHttpMethod reference to be filled in with
       
   331         *                    the value of the Http method.
       
   332         * @return KErrNone if successful or otherwise some system-wide error code.
       
   333         * KErrNotFound if Http method is not found
       
   334         */
       
   335         TInt HttpMethodFromPropertiesL( const TDesC8& aProperties,
       
   336                                         CSenHttpTransportProperties::TSenHttpMethod& aMethod );
       
   337 
       
   338 		TInt SearchIdentityProviderL(CSenIdentityProvider*& aSenChunk, const TDesC8& aProviderId);
       
   339         TInt RegisterAuthenticationObserver();
       
   340         TBool HasConnectionAgentCallbackInitialized();
       
   341         TInt ReauthNeededL(const TDesC8& aProviderId);
       
   342 		TInt RegisterFilesObserver();
       
   343         const TThreadId OwnerThreadId() const;
       
   344         TInt RegisterCoBrandingObserver();
       
   345         
       
   346         TInt RegisterAndSubscribeFileProgressObserversL();
       
   347         
       
   348         virtual TAny* InterfaceByUid( TUid aUID );
       
   349         
       
   350         
       
   351 #ifdef __ENABLE_ALR__
       
   352 	TInt RegisterMobilityObserverL() ;
       
   353 #endif
       
   354 
       
   355     private: // Data
       
   356         RFileLogger                         iLog;
       
   357         RSenServiceConnection               iConnection;    // owned
       
   358         MSenServiceConsumer*                iObserver;      // not owned
       
   359         HBufC8*                             iInBuf;         // owned
       
   360         TPtr8                               iInBuffer;
       
   361         HBufC8*                             iOutBuf;        // owned
       
   362         TPtr8                               iOutBuffer;
       
   363         TBool                               iInitialized;
       
   364         CSenBaseFragment*                   iFragment;
       
   365         TInt                                iResponseLength;
       
   366         TInt                                iErrorNumber;
       
   367         TPtr8                               iErrorNumberBuffer;
       
   368         TInt                                iTxnId;
       
   369         TPtr8                               iTxnIdBuffer;
       
   370 
       
   371         RChunkMap*                          iChunkMap;
       
   372 
       
   373         HBufC*                              ipSessionId;
       
   374         TPtr                                iSessionIdBuffer;
       
   375         TInt                                iChunkNameNumber;
       
   376         HBufC*                              ipChunkName;
       
   377 
       
   378         TBool                               iTransactionIdKnown;
       
   379         TUint                               iAsyncOpsCount;
       
   380         RPointerArray<CSenAsyncOperation>*  iAsyncOpsArray;
       
   381 
       
   382         MSenMessage*                        iResponse;
       
   383 
       
   384         CSenChunk*                          ipInitChunk; // owned
       
   385         TBool*                              ipCompleteServerMsgsOnOff; // owned
       
   386 
       
   387         CSenConnectionStatusObserver*       ipConnectionStatusObserver; // owned
       
   388         CSenFileProgressObserver*			ipFileProgressObserver;     // owned
       
   389 
       
   390         TInt                                iConnectionID;
       
   391         MSenFilesObserver*                  iFilesObserver;	// connectionagent observer
       
   392         //TInt                                iTlsLogChannel;
       
   393         TInt                                iTlsLogStatusChannel;
       
   394 
       
   395         HBufC8*                             ipInitPatternAsXml;
       
   396         HBufC8*                             ipInitConsumerPolicyAsXml;
       
   397         MSenAuthenticationProvider*         ipAuthProvider; // connectionagent observer
       
   398         TBool								iConnectionAgentCallbackInitialized;
       
   399         TBool								iRegisterFileObserverDone;
       
   400         TBool							    iRegisterMobilityObserverDone;
       
   401     	TBool								iRegisterAuthObserverDone;
       
   402     	TBool								iRegisterCoBrandingObserverDone;
       
   403         TBool								iReauthenticationNeeded;
       
   404         MSenCoBrandingObserver*             ipCoBrandingObserver;
       
   405         MSenHostletConsumer*                ipHostletConsumer;
       
   406         MSenExtendedConsumerInterface*      ipExtendedConsumerInterface; // connectionagent observer
       
   407         TAny*                               ipInterface;
       
   408 #ifdef __ENABLE_ALR__
       
   409         MMobilityProtocolResp *				iMobiltyObserver;
       
   410 		TBool                               iMobiltyCallBackReceived;
       
   411 #endif
       
   412         TBool 								iCancelSession;
       
   413         TBool 								iIsInternalSC;
       
   414     
       
   415         TThreadId                           iOwnerThreadId;
       
   416         CSenServiceDispatcher*              ipSenServiceDispatcher;
       
   417         CSenUnderTakerWaiter*               ipSenUnderTakerWaiter;
       
   418         TInt                                iVirtualTransactionCounter;
       
   419         TBool 								iDispatcherEnabled;
       
   420         CSenRegistrationTimer*              ipRegistrationTimer;
       
   421         RFile 								iSharedFileHandle ;		
       
   422     };
       
   423 
       
   424 #ifdef EKA2
       
   425 NONSHARABLE_CLASS(CSenAsyncOperation) : public CActive
       
   426 #else
       
   427 class CSenAsyncOperation : public CActive
       
   428 #endif
       
   429     {
       
   430     public: // Constructors and destructor
       
   431         static CSenAsyncOperation* NewL(CSenServiceConnectionImpl* aActive);
       
   432         static CSenAsyncOperation* NewLC(CSenServiceConnectionImpl* aActive);
       
   433         virtual ~CSenAsyncOperation();
       
   434 
       
   435     protected: // Functions from base classes
       
   436         // from CActive
       
   437         void RunL();
       
   438         void DoCancel();
       
   439        /* TInt RunError(TInt aError); */
       
   440 
       
   441 
       
   442     private:
       
   443         /**
       
   444         * By default Symbian 2nd phase constructor is private.
       
   445         */
       
   446         void ConstructL();
       
   447         CSenAsyncOperation(CSenServiceConnectionImpl* iActive);
       
   448 
       
   449     public: // Data
       
   450         CSenServiceConnectionImpl* iActive;
       
   451         TInt    iErrorNumber;
       
   452         TPtr8   iErrorNumberBuffer;
       
   453         TInt    iTxnId;
       
   454         TPtr8   iTxnIdBuffer;
       
   455 		TInt	iReauthTxnId; // This is used to find connection chunk in the reauthentication loop
       
   456     };
       
   457 
       
   458 #ifdef EKA2
       
   459 NONSHARABLE_CLASS(CSenConnectionStatusObserver) : public CActive
       
   460 #else
       
   461 class CSenConnectionStatusObserver : public CActive
       
   462 #endif
       
   463     {
       
   464     public:
       
   465         static CSenConnectionStatusObserver* NewL(MSenServiceConsumer& aObserver,
       
   466                                                   TInt aConnectionID);
       
   467         static CSenConnectionStatusObserver* NewLC(MSenServiceConsumer& aObserver,
       
   468                                                    TInt aConnectionID);
       
   469         ~CSenConnectionStatusObserver();
       
   470 
       
   471     private:
       
   472         CSenConnectionStatusObserver(MSenServiceConsumer& aObserver,
       
   473                                      TInt aConnectionID);
       
   474         void ConstructL();
       
   475         void RunL();
       
   476         void DoCancel();
       
   477 
       
   478     private:
       
   479         RProperty                   iConnectionStatusProperty;
       
   480         MSenServiceConsumer*        iObserver;                  // not owned
       
   481         TInt                        iConnectionID;
       
   482     };
       
   483     
       
   484     
       
   485 #ifdef EKA2
       
   486 NONSHARABLE_CLASS(CSenFileProgressObserver) : public CActive
       
   487 #else
       
   488 class CSenFileProgressObserver : public CActive
       
   489 #endif
       
   490     {
       
   491     public:
       
   492         static CSenFileProgressObserver* NewL( MSenFilesObserver& aObserver,
       
   493                                                TInt aConnectionID,
       
   494                                                TBool aIsDispatcherEnabled,
       
   495                                                CSenServiceDispatcher* apSenServiceDispatcher, 
       
   496                                                RChunkMap& aChunkMap );
       
   497 
       
   498         static CSenFileProgressObserver* NewLC( MSenFilesObserver& aObserver,
       
   499                                                 TInt aConnectionID,
       
   500                                                 TBool aIsDispatcherEnabled,
       
   501                                                 CSenServiceDispatcher* apSenServiceDispatcher, 
       
   502                                                 RChunkMap& aChunkMap );
       
   503         ~CSenFileProgressObserver();
       
   504 
       
   505     private:
       
   506         CSenFileProgressObserver( MSenFilesObserver& aObserver,
       
   507                                   TInt aConnectionID,
       
   508                                   TBool aIsDispatcherEnabled,
       
   509                                   CSenServiceDispatcher* apSenServiceDispatcher, 
       
   510                                   RChunkMap& aChunkMap );
       
   511         void ConstructL();
       
   512          /*
       
   513         * Method update the consumer about the file progress transfer info
       
   514         */
       
   515         void RunL();
       
   516         void DoCancel();
       
   517         TInt RunError(TInt aError);
       
   518 
       
   519     private:
       
   520         RProperty                   iFileProgressProperty;
       
   521         MSenFilesObserver*        	iFileProgressObserver;        // not owned
       
   522         TInt                        iConnectionID;
       
   523         TBool                       iIsDispatcherEnabled;
       
   524         CSenServiceDispatcher*      ipSenServiceDispatcher;
       
   525         RChunkMap&                  iChunkMap;
       
   526     };    
       
   527 
       
   528 #ifdef EKA2
       
   529 NONSHARABLE_CLASS(CSenBinaryContainer) : public CBase
       
   530 #else
       
   531 class CSenBinaryContainer : public CBase
       
   532 #endif
       
   533     {
       
   534     public:
       
   535     
       
   536     
       
   537         enum TDataType
       
   538             {
       
   539             EFile     = 0,
       
   540             EChunk      = 1,
       
   541             ENumberOfTypes = 2
       
   542             };
       
   543 
       
   544         // Constructors and destructor
       
   545         static CSenBinaryContainer* NewL( const TDesC8& aCid, RFile aFile );
       
   546         static CSenBinaryContainer* NewLC( const TDesC8& aCid, RFile aFile );
       
   547 
       
   548         static CSenBinaryContainer* NewL( const TDesC8& aCid, RChunk aChunk, TInt aChunkSize, TInt aChunkOffset );
       
   549         static CSenBinaryContainer* NewLC( const TDesC8& aCid, RChunk aChunk, TInt aChunkSize, TInt aChunkOffset  );
       
   550 
       
   551         TBool IsFile() const;  // checks iType (TDataType)
       
   552         TBool IsChunk() const; // checks iType (TDataType)
       
   553         TDataType Type() const;
       
   554         
       
   555         TPtrC8 Cid() const;
       
   556         const HBufC8* CidPtr() const;
       
   557         RFile File() const;
       
   558         RChunk Chunk() const;
       
   559         TInt ChunkSize() const;
       
   560         TInt ChunkOffset() const;
       
   561 
       
   562         ~CSenBinaryContainer();
       
   563 
       
   564     private:
       
   565         void ConstructL( const TDesC8& aCid, RFile aFile );
       
   566         void ConstructL( const TDesC8& aCid, RChunk aChunk, TInt aChunkSize, TInt aChunkOffset );
       
   567 
       
   568         CSenBinaryContainer( TDataType aType );
       
   569         
       
   570 
       
   571     private: // Data
       
   572         // "a temporary fix" for issue 21  => in reality, A MAP IS NEEDED (cid, <handle>)  in here (or ipDataContainerArray needs to hold a copy!)
       
   573         TDataType                     iType;
       
   574         HBufC8* 					  ipCid;
       
   575         RFile				   		  iFile;
       
   576         RChunk				   		  iChunk;
       
   577         TInt                          iChunkSize;
       
   578         TInt                          iChunkOffset;
       
   579     };
       
   580 
       
   581 
       
   582 
       
   583 
       
   584 #ifdef EKA2
       
   585 NONSHARABLE_CLASS(CSenConnectionChunk) : public CSenChunk
       
   586 #else
       
   587 class CSenConnectionChunk : public CSenChunk
       
   588 #endif
       
   589     {
       
   590     friend class CSenServiceConnectionImpl;
       
   591     
       
   592     public:
       
   593         // Constructors and destructor
       
   594          static CSenConnectionChunk* NewL(const TDesC& aChunkName, TBool aInternal = EFalse );
       
   595         static CSenConnectionChunk* NewLC(const TDesC& aChunkName, TBool aInternal = EFalse );
       
   596 
       
   597         ~CSenConnectionChunk();
       
   598 
       
   599         // New methods:
       
   600         RArray<TXmlEngDataContainer>& BinaryDataArrayL();	//codescannerwarnings
       
   601         TBool HasBinaryDataArray();
       
   602          TBool HasSharedFileHandle();
       
   603         void HasSharedFileHandle(TBool aHasSharedFileHandle);
       
   604         void RemoveBinaryDataArrayIfEmpty();
       
   605         TInt AddFileToContainerMap( const TDesC8& aCid, RFile aFile );
       
   606         TInt AddChunkToContainerMap( const TDesC8& aCid, RChunk aChunk, TInt aChunkSize, TInt aChunkOffset );
       
   607         RBinaryMap& ContainerMap();
       
   608         TInt ContainerCount();
       
   609 
       
   610 #ifndef RD_SEN_ENABLE_USE_OF_WSD_IN_SC_FOR_HW_TARGET
       
   611         // in WINSCW environment, we don't need to use WSD, since there is no limitation for how many chunk handles a single process can have open
       
   612         TInt ServOpenChunkCount();
       
   613 #else
       
   614 		// use WSD only in hardware builds, since in emulator environment, only a single process can use WSD(!)
       
   615 		static TInt ServOpenChunkCount();
       
   616 #endif       
       
   617     private:
       
   618         void ConstructL(const TDesC& aChunkName);
       
   619 
       
   620         CSenConnectionChunk();
       
   621 
       
   622     private: // Data
       
   623         RArray<TXmlEngDataContainer>* ipDataContainerArray; // owned
       
   624         TBool iHasSharedFileHandle ;		
       
   625         // Proper solution uses the map(!):
       
   626         RBinaryMap                    iMap;
       
   627 #ifndef RD_SEN_ENABLE_USE_OF_WSD_IN_SC_FOR_HW_TARGET
       
   628     	TInt iServOpenChunkCount; // WINS env: no need to have static member. To monitor Server side Open chunk count
       
   629 #else
       
   630     	static TInt iServOpenChunkCount; // ARMv5 env: we need stati member. To monitor Server side Open chunk count
       
   631 #endif        
       
   632     };
       
   633 
       
   634 #endif //SEN_SERVICE_CONNECTION_IMPL_H
       
   635 
       
   636 // End of File