This release addresses the following issues: MSRP_FrameWork
authorPetteri Saari <petteri.saari@digia.com>
Thu, 25 Nov 2010 13:59:42 +0200
branchMSRP_FrameWork
changeset 58 cdb720e67852
parent 25 505ad3f0ce5c
child 59 b365c991829c
This release addresses the following issues: 1. The crash bug fix when receiving file 2. Now the sending is based on MSRP messages, there is no longer file receiving or sending. Client sends data as MSRP was designed. 3. Soma MSRP stack was created so that the client told the correct session-id, Symbian stack generated it by itself. This is not allowed, it was changed so that clients tell the session-id (same as used in SIP INVITE). 4. Unnecessary division of data to chunks removed when there is no need to interrupt sending. The message is sent in as few chunks as possible. 5. Stack can now receive files and chunks with ?unlimited? size. Old stack wrote the incoming data to memory and did not utilize disk space until the end of chunk was reached (large chunks from another client crashed it). 6. Now when writing the incoming data to file, it will take into account the byte-range header values. So, this complies with the RFC4975 requirements that stack must be able to handle chunks that come in any sequence. 7. Some buffering changes to outgoing/incoming data. 8. The outgoing data is now checked that it does not contain the created transaction-id before sending the data. 9. MSRP success reports are now implemented and tested against servers. 10. Progress report system fixed so progress is now visible on client (all the way to 100%). 11. Message Cancel receiving / Cancel sending now corrected and made to work as rfc4975 requires. (termination from sender and error code from receiver when cancelling). 12. Bug correction related to messages received not belonging to any session, old stack implementation did send error response, but after response was written it did give the buffer to client anyway. Now corrected.
Msrp/Group/bld.inf
Msrp/MsrpClient/bwins/msrpclientu.def
Msrp/MsrpClient/eabi/msrpclientu.def
Msrp/MsrpClient/group/MSRPClient.mmp
Msrp/MsrpClient/inc/CMSRP.h
Msrp/MsrpClient/inc/CMSRPImplementation.h
Msrp/MsrpClient/inc/CMSRPSession.h
Msrp/MsrpClient/inc/CMSRPSessionImplementation.h
Msrp/MsrpClient/inc/MMSRPServerInterface.h
Msrp/MsrpClient/inc/MMSRPSessionObserver.h
Msrp/MsrpClient/inc/RMSRPSession.h
Msrp/MsrpClient/src/CMSRP.cpp
Msrp/MsrpClient/src/CMSRPImplementation.cpp
Msrp/MsrpClient/src/CMSRPIncomingListener.cpp
Msrp/MsrpClient/src/CMSRPSendResultListener.cpp
Msrp/MsrpClient/src/CMSRPSession.cpp
Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp
Msrp/MsrpClient/src/RMSRPSession.cpp
Msrp/MsrpHeader/bwins/msrpheaderu.def
Msrp/MsrpHeader/eabi/msrpheaderu.def
Msrp/MsrpHeader/group/msrpheader.mmp
Msrp/MsrpHeader/inc/CMSRPMessageBase.h
Msrp/MsrpHeader/inc/CMsrpMessage.h
Msrp/MsrpHeader/inc/CMsrpReport.h
Msrp/MsrpHeader/inc/CMsrpResponse.h
Msrp/MsrpHeader/inc/CMsrpStatusHeader.h
Msrp/MsrpHeader/src/CMSRPMessageBase.cpp
Msrp/MsrpHeader/src/CMsrpMessage.cpp
Msrp/MsrpHeader/src/CMsrpReport.cpp
Msrp/MsrpHeader/src/CMsrpStatusHeader.cpp
Msrp/MsrpServer/group/msrpserver.mmp
Msrp/MsrpServer/inc/CMSRPConnection.h
Msrp/MsrpServer/inc/CMSRPConnectionManager.h
Msrp/MsrpServer/inc/CMSRPMessageChunkState.h
Msrp/MsrpServer/inc/CMSRPMessageHandler.h
Msrp/MsrpServer/inc/CMSRPMsgParser.h
Msrp/MsrpServer/inc/CMSRPServerSubSession.h
Msrp/MsrpServer/inc/CMSRPWriter.h
Msrp/MsrpServer/inc/MMSRPConnection.h
Msrp/MsrpServer/inc/MMSRPConnectionManager.h
Msrp/MsrpServer/inc/MMSRPConnectionObserver.h
Msrp/MsrpServer/inc/MMSRPIncomingMessage.h
Msrp/MsrpServer/inc/MMSRPMessageHandler.h
Msrp/MsrpServer/inc/MMSRPMessageObserver.h
Msrp/MsrpServer/inc/MMSRPOutgoingMessage.h
Msrp/MsrpServer/inc/MMSRPParserObserver.h
Msrp/MsrpServer/inc/MMSRPWriter.h
Msrp/MsrpServer/inc/MMSRPWriterObserver.h
Msrp/MsrpServer/inc/MSRPServerCommon.h
Msrp/MsrpServer/inc/TStates.h
Msrp/MsrpServer/src/CMSRPConnection.cpp
Msrp/MsrpServer/src/CMSRPConnectionManager.cpp
Msrp/MsrpServer/src/CMSRPConnector.cpp
Msrp/MsrpServer/src/CMSRPMessageChunkState.cpp
Msrp/MsrpServer/src/CMSRPMessageHandler.cpp
Msrp/MsrpServer/src/CMSRPMsgParser.cpp
Msrp/MsrpServer/src/CMSRPReader.cpp
Msrp/MsrpServer/src/CMSRPServerSession.cpp
Msrp/MsrpServer/src/CMSRPServerSubSession.cpp
Msrp/MsrpServer/src/CMSRPWriter.cpp
Msrp/MsrpServer/src/TStateFactory.cpp
Msrp/MsrpServer/src/TStates.cpp
Msrp/inc/MsrpCommon.h
--- a/Msrp/Group/bld.inf	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/Group/bld.inf	Thu Nov 25 13:59:42 2010 +0200
@@ -14,6 +14,8 @@
 *
 */
 
+#include <platform_paths.hrh>
+
 PRJ_PLATFORMS
     DEFAULT
     
--- a/Msrp/MsrpClient/bwins/msrpclientu.def	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/bwins/msrpclientu.def	Thu Nov 25 13:59:42 2010 +0200
@@ -1,24 +1,22 @@
 EXPORTS
-	?ReceiveFile@CMSRPSession@@QAEHABV?$TBuf@$0BAA@@@HABVTDesC8@@@Z @ 1 NONAME ; int CMSRPSession::ReceiveFile(class TBuf<256> const &, int, class TDesC8 const &)
-	?NewL@CMSRPSessionParams@@SAPAV1@XZ @ 2 NONAME ; class CMSRPSessionParams * CMSRPSessionParams::NewL(void)
-	?SendFile@CMSRPSession@@QAEHABV?$TBuf@$0BAA@@@ABVTDesC8@@@Z @ 3 NONAME ; int CMSRPSession::SendFile(class TBuf<256> const &, class TDesC8 const &)
+	??1CMSRP@@UAE@XZ @ 1 NONAME ; CMSRP::~CMSRP(void)
+	??1CMSRPSessionParams@@UAE@XZ @ 2 NONAME ; CMSRPSessionParams::~CMSRPSessionParams(void)
+	?CancelReceiving@CMSRPSession@@QAEHAAVTDesC8@@@Z @ 3 NONAME ; int CMSRPSession::CancelReceiving(class TDesC8 &)
 	?CancelSending@CMSRPSession@@QAEHAAVTDesC8@@@Z @ 4 NONAME ; int CMSRPSession::CancelSending(class TDesC8 &)
-	??1CMSRPSessionParams@@UAE@XZ @ 5 NONAME ; CMSRPSessionParams::~CMSRPSessionParams(void)
-	?SuccessReportHeader@CMSRPSessionParams@@QAE?AW4TReportStatus@@XZ @ 6 NONAME ; enum TReportStatus CMSRPSessionParams::SuccessReportHeader(void)
-	?NewLC@CMSRP@@SAPAV1@ABVTUid@@@Z @ 7 NONAME ; class CMSRP * CMSRP::NewLC(class TUid const &)
-	?Listen@CMSRPSession@@QAEHABVTDesC8@@@Z @ 8 NONAME ; int CMSRPSession::Listen(class TDesC8 const &)
-	?SetReportHeadersL@CMSRPSessionParams@@QAEXW4TReportStatus@@0@Z @ 9 NONAME ; void CMSRPSessionParams::SetReportHeadersL(enum TReportStatus, enum TReportStatus)
-	?SendBuffer@CMSRPSession@@QAEPAVHBufC8@@ABVTDesC8@@0@Z @ 10 NONAME ; class HBufC8 * CMSRPSession::SendBuffer(class TDesC8 const &, class TDesC8 const &)
-	?Connect@CMSRPSession@@QAEHABVTDesC8@@@Z @ 11 NONAME ; int CMSRPSession::Connect(class TDesC8 const &)
-	?FailureReportHeader@CMSRPSessionParams@@QAE?AW4TReportStatus@@XZ @ 12 NONAME ; enum TReportStatus CMSRPSessionParams::FailureReportHeader(void)
-	??1CMSRP@@UAE@XZ @ 13 NONAME ; CMSRP::~CMSRP(void)
-	?CancelReceiveFile@CMSRPSession@@QAEHXZ @ 14 NONAME ; int CMSRPSession::CancelReceiveFile(void)
-	?SetSessionParams@CMSRPSession@@QAEXAAVCMSRPSessionParams@@@Z @ 15 NONAME ; void CMSRPSession::SetSessionParams(class CMSRPSessionParams &)
-	?CloseMSRPSession@CMSRP@@QAEXPAVCMSRPSession@@@Z @ 16 NONAME ; void CMSRP::CloseMSRPSession(class CMSRPSession *)
-	?CancelFileSending@CMSRPSession@@QAEHXZ @ 17 NONAME ; int CMSRPSession::CancelFileSending(void)
-	?ConstructL@CMSRP@@AAEXABVTUid@@@Z @ 18 NONAME ; void CMSRP::ConstructL(class TUid const &)
-	?LocalMSRPPath@CMSRPSession@@QAEAAVTDesC8@@XZ @ 19 NONAME ; class TDesC8 & CMSRPSession::LocalMSRPPath(void)
-	?CreateMSRPSessionL@CMSRP@@QAEPAVCMSRPSession@@AAVMMSRPSessionObserver@@I@Z @ 20 NONAME ; class CMSRPSession * CMSRP::CreateMSRPSessionL(class MMSRPSessionObserver &, unsigned int)
-	?NotifyProgress@CMSRPSession@@QAEXH@Z @ 21 NONAME ; void CMSRPSession::NotifyProgress(int)
-	?NewL@CMSRP@@SAPAV1@ABVTUid@@@Z @ 22 NONAME ; class CMSRP * CMSRP::NewL(class TUid const &)
+	?CloseMSRPSession@CMSRP@@QAEXPAVCMSRPSession@@@Z @ 5 NONAME ; void CMSRP::CloseMSRPSession(class CMSRPSession *)
+	?Connect@CMSRPSession@@QAEHABVTDesC8@@@Z @ 6 NONAME ; int CMSRPSession::Connect(class TDesC8 const &)
+	?ConstructL@CMSRP@@AAEXABVTUid@@@Z @ 7 NONAME ; void CMSRP::ConstructL(class TUid const &)
+	?CreateMSRPSessionL@CMSRP@@QAEPAVCMSRPSession@@AAVMMSRPSessionObserver@@IABVTDesC8@@@Z @ 8 NONAME ; class CMSRPSession * CMSRP::CreateMSRPSessionL(class MMSRPSessionObserver &, unsigned int, class TDesC8 const &)
+	?FailureReportHeader@CMSRPSessionParams@@QAE?AW4TReportStatus@@XZ @ 9 NONAME ; enum TReportStatus CMSRPSessionParams::FailureReportHeader(void)
+	?Listen@CMSRPSession@@QAEHABVTDesC8@@@Z @ 10 NONAME ; int CMSRPSession::Listen(class TDesC8 const &)
+	?LocalMSRPPath@CMSRPSession@@QAEAAVTDesC8@@XZ @ 11 NONAME ; class TDesC8 & CMSRPSession::LocalMSRPPath(void)
+	?NewL@CMSRP@@SAPAV1@ABVTUid@@@Z @ 12 NONAME ; class CMSRP * CMSRP::NewL(class TUid const &)
+	?NewL@CMSRPSessionParams@@SAPAV1@XZ @ 13 NONAME ; class CMSRPSessionParams * CMSRPSessionParams::NewL(void)
+	?NewLC@CMSRP@@SAPAV1@ABVTUid@@@Z @ 14 NONAME ; class CMSRP * CMSRP::NewLC(class TUid const &)
+	?NotifyProgress@CMSRPSession@@QAEXH@Z @ 15 NONAME ; void CMSRPSession::NotifyProgress(int)
+	?SendBuffer@CMSRPSession@@QAEPAVHBufC8@@ABVTDesC8@@0@Z @ 16 NONAME ; class HBufC8 * CMSRPSession::SendBuffer(class TDesC8 const &, class TDesC8 const &)
+	?SendFile@CMSRPSession@@QAEPAVHBufC8@@ABV?$TBuf@$0BAA@@@ABVTDesC8@@@Z @ 17 NONAME ; class HBufC8 * CMSRPSession::SendFile(class TBuf<256> const &, class TDesC8 const &)
+	?SetReportHeadersL@CMSRPSessionParams@@QAEXW4TReportStatus@@0@Z @ 18 NONAME ; void CMSRPSessionParams::SetReportHeadersL(enum TReportStatus, enum TReportStatus)
+	?SetSessionParams@CMSRPSession@@QAEXAAVCMSRPSessionParams@@@Z @ 19 NONAME ; void CMSRPSession::SetSessionParams(class CMSRPSessionParams &)
+	?SuccessReportHeader@CMSRPSessionParams@@QAE?AW4TReportStatus@@XZ @ 20 NONAME ; enum TReportStatus CMSRPSessionParams::SuccessReportHeader(void)
 
--- a/Msrp/MsrpClient/eabi/msrpclientu.def	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/eabi/msrpclientu.def	Thu Nov 25 13:59:42 2010 +0200
@@ -1,48 +1,46 @@
 EXPORTS
 	_ZN12CMSRPSession10SendBufferERK6TDesC8S2_ @ 1 NONAME
-	_ZN12CMSRPSession11ReceiveFileERK4TBufILi256EEiRK6TDesC8 @ 2 NONAME
-	_ZN12CMSRPSession13CancelSendingER6TDesC8 @ 3 NONAME
-	_ZN12CMSRPSession13LocalMSRPPathEv @ 4 NONAME
-	_ZN12CMSRPSession14NotifyProgressEi @ 5 NONAME
+	_ZN12CMSRPSession13CancelSendingER6TDesC8 @ 2 NONAME
+	_ZN12CMSRPSession13LocalMSRPPathEv @ 3 NONAME
+	_ZN12CMSRPSession14NotifyProgressEi @ 4 NONAME
+	_ZN12CMSRPSession15CancelReceivingER6TDesC8 @ 5 NONAME
 	_ZN12CMSRPSession16SetSessionParamsER18CMSRPSessionParams @ 6 NONAME
-	_ZN12CMSRPSession17CancelFileSendingEv @ 7 NONAME
-	_ZN12CMSRPSession17CancelReceiveFileEv @ 8 NONAME
-	_ZN12CMSRPSession6ListenERK6TDesC8 @ 9 NONAME
-	_ZN12CMSRPSession7ConnectERK6TDesC8 @ 10 NONAME
-	_ZN12CMSRPSession8SendFileERK4TBufILi256EERK6TDesC8 @ 11 NONAME
-	_ZN18CMSRPSessionParams17SetReportHeadersLE13TReportStatusS0_ @ 12 NONAME
-	_ZN18CMSRPSessionParams19FailureReportHeaderEv @ 13 NONAME
-	_ZN18CMSRPSessionParams19SuccessReportHeaderEv @ 14 NONAME
-	_ZN18CMSRPSessionParams4NewLEv @ 15 NONAME
-	_ZN18CMSRPSessionParamsD0Ev @ 16 NONAME
-	_ZN18CMSRPSessionParamsD1Ev @ 17 NONAME
-	_ZN18CMSRPSessionParamsD2Ev @ 18 NONAME
-	_ZN5CMSRP10ConstructLERK4TUid @ 19 NONAME
-	_ZN5CMSRP16CloseMSRPSessionEP12CMSRPSession @ 20 NONAME
-	_ZN5CMSRP18CreateMSRPSessionLER20MMSRPSessionObserverj @ 21 NONAME
-	_ZN5CMSRP4NewLERK4TUid @ 22 NONAME
-	_ZN5CMSRP5NewLCERK4TUid @ 23 NONAME
-	_ZN5CMSRPD0Ev @ 24 NONAME
-	_ZN5CMSRPD1Ev @ 25 NONAME
-	_ZN5CMSRPD2Ev @ 26 NONAME
-	_ZTI12CMSRPSession @ 27 NONAME
-	_ZTI12RMSRPSession @ 28 NONAME
-	_ZTI17CMSRPListenerBase @ 29 NONAME
-	_ZTI18CMSRPSessionParams @ 30 NONAME
-	_ZTI19CMSRPImplementation @ 31 NONAME
-	_ZTI21CMSRPIncomingListener @ 32 NONAME
-	_ZTI23CMSRPConnectionListener @ 33 NONAME
-	_ZTI23CMSRPSendResultListener @ 34 NONAME
-	_ZTI26CMSRPSessionImplementation @ 35 NONAME
-	_ZTI5CMSRP @ 36 NONAME
-	_ZTV12CMSRPSession @ 37 NONAME
-	_ZTV12RMSRPSession @ 38 NONAME
-	_ZTV17CMSRPListenerBase @ 39 NONAME
-	_ZTV18CMSRPSessionParams @ 40 NONAME
-	_ZTV19CMSRPImplementation @ 41 NONAME
-	_ZTV21CMSRPIncomingListener @ 42 NONAME
-	_ZTV23CMSRPConnectionListener @ 43 NONAME
-	_ZTV23CMSRPSendResultListener @ 44 NONAME
-	_ZTV26CMSRPSessionImplementation @ 45 NONAME
-	_ZTV5CMSRP @ 46 NONAME
+	_ZN12CMSRPSession6ListenERK6TDesC8 @ 7 NONAME
+	_ZN12CMSRPSession7ConnectERK6TDesC8 @ 8 NONAME
+	_ZN12CMSRPSession8SendFileERK4TBufILi256EERK6TDesC8 @ 9 NONAME
+	_ZN18CMSRPSessionParams17SetReportHeadersLE13TReportStatusS0_ @ 10 NONAME
+	_ZN18CMSRPSessionParams19FailureReportHeaderEv @ 11 NONAME
+	_ZN18CMSRPSessionParams19SuccessReportHeaderEv @ 12 NONAME
+	_ZN18CMSRPSessionParams4NewLEv @ 13 NONAME
+	_ZN18CMSRPSessionParamsD0Ev @ 14 NONAME
+	_ZN18CMSRPSessionParamsD1Ev @ 15 NONAME
+	_ZN18CMSRPSessionParamsD2Ev @ 16 NONAME
+	_ZN5CMSRP10ConstructLERK4TUid @ 17 NONAME
+	_ZN5CMSRP16CloseMSRPSessionEP12CMSRPSession @ 18 NONAME
+	_ZN5CMSRP18CreateMSRPSessionLER20MMSRPSessionObserverjRK6TDesC8 @ 19 NONAME
+	_ZN5CMSRP4NewLERK4TUid @ 20 NONAME
+	_ZN5CMSRP5NewLCERK4TUid @ 21 NONAME
+	_ZN5CMSRPD0Ev @ 22 NONAME
+	_ZN5CMSRPD1Ev @ 23 NONAME
+	_ZN5CMSRPD2Ev @ 24 NONAME
+	_ZTI12CMSRPSession @ 25 NONAME ; #<TI>#
+	_ZTI12RMSRPSession @ 26 NONAME ; #<TI>#
+	_ZTI17CMSRPListenerBase @ 27 NONAME ; #<TI>#
+	_ZTI18CMSRPSessionParams @ 28 NONAME ; #<TI>#
+	_ZTI19CMSRPImplementation @ 29 NONAME ; #<TI>#
+	_ZTI21CMSRPIncomingListener @ 30 NONAME ; #<TI>#
+	_ZTI23CMSRPConnectionListener @ 31 NONAME ; #<TI>#
+	_ZTI23CMSRPSendResultListener @ 32 NONAME ; #<TI>#
+	_ZTI26CMSRPSessionImplementation @ 33 NONAME ; #<TI>#
+	_ZTI5CMSRP @ 34 NONAME ; #<TI>#
+	_ZTV12CMSRPSession @ 35 NONAME ; #<VT>#
+	_ZTV12RMSRPSession @ 36 NONAME ; #<VT>#
+	_ZTV17CMSRPListenerBase @ 37 NONAME ; #<VT>#
+	_ZTV18CMSRPSessionParams @ 38 NONAME ; #<VT>#
+	_ZTV19CMSRPImplementation @ 39 NONAME ; #<VT>#
+	_ZTV21CMSRPIncomingListener @ 40 NONAME ; #<VT>#
+	_ZTV23CMSRPConnectionListener @ 41 NONAME ; #<VT>#
+	_ZTV23CMSRPSendResultListener @ 42 NONAME ; #<VT>#
+	_ZTV26CMSRPSessionImplementation @ 43 NONAME ; #<VT>#
+	_ZTV5CMSRP @ 44 NONAME ; #<VT>#
 
--- a/Msrp/MsrpClient/group/MSRPClient.mmp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/group/MSRPClient.mmp	Thu Nov 25 13:59:42 2010 +0200
@@ -14,13 +14,12 @@
 *
 */
 
-
+#include <platform_paths.hrh>
 
 TARGET		  msrpclient.dll
 TARGETTYPE	  dll
 UID			 0x1000008d 0x2002B59C
 
-OS_LAYER_SYSTEMINCLUDE
 MW_LAYER_SYSTEMINCLUDE
 
 USERINCLUDE ../../inc 
@@ -75,6 +74,3 @@
 #ifdef ENABLE_ABIV2_MODE
 DEBUGGABLE_UDEBONLY
 #endif
-
-EXPORTUNFROZEN
-
--- a/Msrp/MsrpClient/inc/CMSRP.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/CMSRP.h	Thu Nov 25 13:59:42 2010 +0200
@@ -55,13 +55,16 @@
     /**
      * Creates an msrp session for the client
      * @param aObserver a reference to the session observer created by the client.
-     * This client-side observer receives callbacks from the msrp stack, in order to
-     * notify it of varous events
+     *        This client-side observer receives callbacks from the msrp stack, in order to
+     *        notify it of varous events
      * @param aIapId the IAP on which the connection has to start for this session
+     * @param aSessionId session id of this MSRP session. This comes from the
+     *        path SDP attribute where session id is used
      * @return the created session object which can be used by the client
      */
     IMPORT_C CMSRPSession* CreateMSRPSessionL( MMSRPSessionObserver& aObserver, 
-                                               const TUint aIapId );
+                                               const TUint aIapId,
+                                               const TDesC8& aSessionId );
     
     /** 
      * Closes the msrp session that the client had created.
--- a/Msrp/MsrpClient/inc/CMSRPImplementation.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/CMSRPImplementation.h	Thu Nov 25 13:59:42 2010 +0200
@@ -39,8 +39,19 @@
     
     ~CMSRPImplementation();
     
+    /**
+     * Creates an msrp session for the client
+     * @param aObserver a reference to the session observer created by the client.
+     *        This client-side observer receives callbacks from the msrp stack, in order to
+     *        notify it of varous events
+     * @param aIapId the IAP on which the connection has to start for this session
+     * @param aSessionId session id of this MSRP session. This comes from the
+     *        path SDP attribute where session id is used
+     * @return the created session object which can be used by the client
+     */
     CMSRPSession* CreateMSRPSessionL( MMSRPSessionObserver& aObserver, 
-                                      const TUint aIapId );
+                                      const TUint aIapId,
+                                      const TDesC8& aSessionId );
     
     void CloseMSRPSession( CMSRPSession* aMsrpSession );
         
--- a/Msrp/MsrpClient/inc/CMSRPSession.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/CMSRPSession.h	Thu Nov 25 13:59:42 2010 +0200
@@ -27,114 +27,159 @@
 class CMSRPMessage;
 class CMSRPSessionParams;
 
-
+// CLASS DECLARATION
+/**
+* Class provides an interface for MSRP clients to access MSRP functionality
+*
+*/
 class CMSRPSession : public CBase
     {
+    // friend class provides the actual implementation
     friend class CMSRPImplementation;
     
-public:    
-    
-    /** 
-     * Object Creation. This is not exported to the client. It is called
-     * while attempting to create an msrp session.
-     * @param aRMSRP an instance of the client server session
-     * @param aObserver the session observer that is created by the client
-     * @param aIapId IAP id of the application
-     * @return session object
-     */
-    static CMSRPSession* NewL( RMSRP& aRMSRP,
-                                        MMSRPSessionObserver& aObserver, 
-                                        const TUint aIapId );
+    public:    
+        
+        /** 
+         * Object Creation. This is not exported to the client. It is called
+         * while attempting to create an msrp session.
+         * @param aRMSRP an instance of the client server session
+         * @param aObserver the session observer that is created by the client
+         * @param aIapId IAP id of the application
+         * @param aSessionId session id of this MSRP session. This comes from the
+         *        path SDP attribute where session id is used
+         * @return session object
+         */
+        static CMSRPSession* NewL( RMSRP& aRMSRP,
+                                            MMSRPSessionObserver& aObserver, 
+                                            const TUint aIapId,
+                                            const TDesC8& aSessionId );
+            
+        /** 
+         * Object Creation. This is not exported to the client. It is called
+         * while attempting to create an msrp session.
+         * @param aRMSRP an instance of the client server session
+         * @param aObserver the session observer that is created by the client
+         * @param aIapId IAP id of the application
+         * @param aSessionId session id of this MSRP session. This comes from the
+         *        path SDP attribute where session id is used
+         * @return session object
+         */
+        static CMSRPSession* NewLC( RMSRP& aRMSRP,
+                                             MMSRPSessionObserver& aObserver,
+                                             const TUint aIapId,
+                                             const TDesC8& aSessionId );
         
-    /** 
-     * Object Creation. This is not exported to the client. It is called
-     * while attempting to create an msrp session.
-     * @param aRMSRP an instance of the client server session
-     * @param aObserver the session observer that is created by the client
-     * @param aIapId IAP id of the application
-     * @return session object
-     */
-    static CMSRPSession* NewLC( RMSRP& aRMSRP,
-                                         MMSRPSessionObserver& aObserver,
-                                         const TUint aIapId );
+    public:
+    
+        // === Post Creation; SDP negotiation parameter fetching.
+                    
+        /**
+         * Gives the local MSRP path that is used in the "a" line of SDP
+         * @return local msrp path
+         */    
+        IMPORT_C TDesC8& LocalMSRPPath();
     
-public:
-
-    // === Post Creation; SDP negotiation parameter fetching.
-                
-    /**
-     * Gives the local MSRP path that is used in the "a" line of SDP
-     * @return local msrp path
-     */    
-    IMPORT_C TDesC8& LocalMSRPPath();
-
-    /**
-     * Sets the various parameters related to an MSRP session
-     * @param aSessionParams the session settings object from which the 
-     * settings need to be incorporated into the msrp session.
-     * Eg. SR and FR report headers can be set using this
-     */    
-    IMPORT_C void SetSessionParams( CMSRPSessionParams& aSessionParams );
-    
-    
-    // === Post SDP Negotiation; Connection Setup.
+        /**
+         * Sets the various parameters related to an MSRP session
+         * @param aSessionParams the session settings object from which the 
+         * settings need to be incorporated into the msrp session.
+         * Eg. SR and FR report headers can be set using this
+         */    
+        IMPORT_C void SetSessionParams( CMSRPSessionParams& aSessionParams );
+        
+        
+        // === Post SDP Negotiation; Connection Setup.
+            
+        /**
+         * Connects to the remote node
+         * @param aRemoteMsrpPath the msrp path of the remote node
+         * This is obtained through the SDP negotiation
+         * @return KErrNone or system wide error codes
+         */
+        IMPORT_C TInt Connect( const TDesC8& aRemoteMsrpPath );
+        
+        /**
+         * Listens for connections from the remote node
+         * @param aRemoteMsrpPath the msrp path of the remote node
+         * This is obtained through the SDP negotiation
+         * @return KErrNone or system wide error codes
+         */
+        IMPORT_C TInt Listen ( const TDesC8& aRemoteMsrpPath );
+        
         
-    /**
-     * Connects to the remote node
-     * @param aRemoteMsrpPath the msrp path of the remote node
-     * This is obtained through the SDP negotiation
-     * @return KErrNone or system wide error codes
-     */
-    IMPORT_C TInt Connect( const TDesC8& aRemoteMsrpPath );
+        // === Post Connection setup; Data Trasfer. 
+       
+        /**
+         * Sends a message to the currently connected client
+         * Note: connection must be established before calling this
+         * function
+         * @param aMessage the data that needs to be sent
+         * @param aMimeType the mime type of the data
+         * @return the id of the message that was sent by the msrp stack
+         *         NULL pointer if sending message failed
+         */
+        IMPORT_C HBufC8* SendBuffer( const TDesC8& aMessage, const TDesC8& aMimeType );
+            
+        /**
+         * Cancels the send operation initiated by the client
+         * @param aMessageId the id of the message that needs to be cancelled
+         * @return KErrNone or system wide error codes
+         */
+        IMPORT_C TInt CancelSending( TDesC8& aMessageId );
     
-    /**
-     * Listens for connections from the remote node
-     * @param aRemoteMsrpPath the msrp path of the remote node
-     * This is obtained through the SDP negotiation
-     * @return KErrNone or system wide error codes
-     */
-    IMPORT_C TInt Listen ( const TDesC8& aRemoteMsrpPath );
-    
-    
-    // === Post Connection setup; Data Trasfer. 
-   
-    /**
-     * Sends a message to the remote note that is connected
-     * @param aMessage the data that needs to be sent
-     * @param aMimeType the mime type of the data
-     * @return the id of the message that was sent by the msrp stack
-     */
-    IMPORT_C HBufC8* SendBuffer( const TDesC8& aMessage, const TDesC8& aMimeType );
+        /**
+         * Sends a message to the currently connected client. The message is given
+         * in a file
+         * Note: connection must be established before calling this
+         * function
+         * @param aFilename name of the file to be transmitted, must include file path
+         * @param aMimeType the mime type of the data
+         * @return the id of the message that was sent by the msrp stack
+         *         NULL pointer if sending message failed
+         */
+        IMPORT_C HBufC8* SendFile( const TFileName& aFileName, const TDesC8& aMimeType );
         
-    /**
-     * Cancels the send operation initiated by the client
-     * @param aMessageId the id of the message that needs to be cancelled
-     * @return KErrNone or system wide error codes
-     */
-    IMPORT_C TInt CancelSending( TDesC8& aMessageId );
-
-    IMPORT_C TInt SendFile( const TFileName& aFileName, const TDesC8& aMimeType );
+        /**
+         * Cancels the receiving of a given message
+         * @param aMessageId the id of the message that needs to be cancelled
+         * @return System-wide error message
+         */
+        IMPORT_C TInt CancelReceiving( TDesC8& aMessageId );
+        
+        /**
+         * Client can use this function to indicate whether it wants to receive
+         * progress reports or not
+         * @param aFlag true if client wants progress reports, false otherwise,
+         *        By default the progress reports are off
+         */
+        IMPORT_C void NotifyProgress( TBool aFlag );
     
-    IMPORT_C TInt CancelFileSending();
-    
-    IMPORT_C TInt ReceiveFile(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType );
-
-    IMPORT_C TInt CancelReceiveFile();
+    private:
     
-    IMPORT_C void NotifyProgress(TBool aFlag);
+        /**
+         * Second phase constructor
+         * @param aRMSRP RMSRP session class to server
+         * @param aObserver SessionObserver interface
+         * @param aIapId internet access point ID
+         * @param aSessionId session id of this MSRP session. This comes from the
+         *        path SDP attribute where session id is used
+         */
+        void ConstructL( RMSRP& aRMSRP,
+                         MMSRPSessionObserver& aObserver,
+                         const TUint aIapId,
+                         const TDesC8& aSessionId );
+        
+        /**
+         * class destructor
+         */
+        ~CMSRPSession();
+            
+    private:
     
-
-private:
-    void ConstructL( RMSRP& aRMSRP,
-                     MMSRPSessionObserver& aObserver,
-                     const TUint aIapId );
-    
-    ~CMSRPSession();
-        
-private:
-           
-    CMSRPSessionImplementation* iMSRPSessionImpl;
-    
+        // Session implementation instance, owned
+        CMSRPSessionImplementation* iMSRPSessionImpl;
     };
 
 #endif /* CMSRPSESSION_H_ */
+
+// End of File
--- a/Msrp/MsrpClient/inc/CMSRPSessionImplementation.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/CMSRPSessionImplementation.h	Thu Nov 25 13:59:42 2010 +0200
@@ -32,102 +32,136 @@
 class RMSRP;
 class CMSRPSessionParams;
 
-
+// CLASS DECLARATION
+/**
+* This is an implementation class for CMSRPSession class.
+*
+*/
 class CMSRPSessionImplementation : public CBase
     {
-public:       
-    static CMSRPSessionImplementation* NewL( RMSRP& aRMSRP,
-                                             MMSRPSessionObserver& aObserver,
-                                             const TUint aIapId );
-    
-    static CMSRPSessionImplementation* NewLC( RMSRP& aRMSRP,
-                                              MMSRPSessionObserver& aObserver,
-                                              const TUint aIapId );
-    
-    ~CMSRPSessionImplementation();
+    public:       
     
-public:
-    
-    TDesC8& LocalMSRPPath();
-    
-    void SetSessionParams( CMSRPSessionParams& aSessionParams );
-    
-    void ConnectL( const TDesC8& aRemoteMsrpPath );
-    
-    void ListenL( const TDesC8& aRemoteMsrpPath );
-        
-    HBufC8* SendBufferL( const TDesC8& aMessage, const TDesC8& aMimeType );
+        /** 
+         * Object Creation. This is not exported to the client. It is called
+         * while attempting to create an msrp session.
+         * @param aRMSRP an instance of the client server session
+         * @param aObserver the session observer that is created by the client
+         * @param aIapId IAP id of the application
+         * @param aSessionId session id of this MSRP session. This comes from the
+         *        path SDP attribute where session id is used
+         * @return session object
+         */
+         static CMSRPSessionImplementation* NewL( RMSRP& aRMSRP,
+                                                 MMSRPSessionObserver& aObserver,
+                                                 const TUint aIapId,
+                                                 const TDesC8& aSessionId );
         
-    void CancelSendingL( TDesC8& aMessageId );
-    
+         /** 
+          * Object Creation. This is not exported to the client. It is called
+          * while attempting to create an msrp session.
+          * @param aRMSRP an instance of the client server session
+          * @param aObserver the session observer that is created by the client
+          * @param aIapId IAP id of the application
+          * @param aSessionId session id of this MSRP session. This comes from the
+          *        path SDP attribute where session id is used
+          * @return session object
+          */
+        static CMSRPSessionImplementation* NewLC( RMSRP& aRMSRP,
+                                                  MMSRPSessionObserver& aObserver,
+                                                  const TUint aIapId,
+                                                  const TDesC8& aSessionId );
         
-    void ConnectionEstablishedL( TInt aStatus );
-    
-    void HandleIncomingMessageL( const TDesC8& aIncomingMessage,
-                                 TInt aStatus );
-    void ReceiveProgress(TInt aBytesReceived, TInt aTotalBytes);
-    
-    void SendProgress(TInt aBytesSent, TInt aTotalBytes);
-    
-    void SendStatusL( TInt aStatus, const TDesC8& aMessageid );
-	
-    void HandleConnectionErrors( TInt aErrorStatus );
-    
-	void SendFileL( const TFileName& aFileName,const TDesC8& aMimeType );
-	 
-	void NotifyProgress(TBool aFlag);
-
-	void ReceiveFileL(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType);
-
-private:
+        ~CMSRPSessionImplementation();
+        
+    public:
+        
+        TDesC8& LocalMSRPPath();
+        
+        void SetSessionParams( CMSRPSessionParams& aSessionParams );
+        
+        void ConnectL( const TDesC8& aRemoteMsrpPath );
+        
+        void ListenL( const TDesC8& aRemoteMsrpPath );
+            
+        HBufC8* SendBufferL( const TDesC8& aMessage, const TDesC8& aMimeType );
+            
+        void CancelSendingL( TDesC8& aMessageId );
+        
+        void CancelReceivingL( TDesC8& aMessageId );
     
-    CMSRPMessage* CreateMsrpMessageL( const TDesC8& aMessage, const TDesC8& aToPath, 
-                                      const TDesC8& aFromPath, const TDesC8& aMimeType );
-    
-    void SendMessageL( CMSRPMessage* aMessage );
-    
-    void GetRemotePathComponentsL( TPtrC8& aRemoteHost, TUint& aRemotePort, TPtrC8& aRemoteSessionID );
-    
-    CMSRPMessage* SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
-                                                               const TDesC8& aFromPath, 
-                                                               const TDesC8& aMimeType );
-private:
-    
-    CMSRPSessionImplementation( RMSRP& aRMSRP,
-                                MMSRPSessionObserver& aObserver );
-    
-    void ConstructL( const TUint aIapId );
+        void ConnectionEstablishedL( TInt aStatus );
+        
+        void HandleIncomingMessageL( const TDesC8& aIncomingMessage,
+                                     TInt aStatus );
+        void ReceiveProgress( const TDesC8& aMessageId, TInt aBytesReceived, TInt aTotalBytes);
+        
+        void SendProgress(const TDesC8& aMessageId, TInt aBytesSent, TInt aTotalBytes);
         
-private:
-    
-    RMSRP& iRMSRP;
-    
-    MMSRPSessionObserver& iSessionObserver;
+        void SendStatusL( TInt aStatus, const TDesC8& aMessageid );
+        
+        void HandleConnectionErrors( TInt aErrorStatus );
+        
+        HBufC8* SendFileL( const TFileName& aFileName,const TDesC8& aMimeType );
+        
+        void NotifyProgress(TBool aFlag);
     
-    RMSRPSession* iMSRPSession;
-    
-    RBuf8 iLocalMsrpPath;
-    
-    RBuf8 iRemoteMsrpPath;
-    
-    TReportStatus iSuccessReport;
-    
-    TReportStatus iFailureReport;
+    private:
+        
+        CMSRPMessage* CreateMsrpMessageL( const TDesC8& aMessage, const TDesC8& aToPath, 
+                                          const TDesC8& aFromPath, const TDesC8& aMimeType );
+        
+        void SendMessageL( CMSRPMessage* aMessage );
+        
+        void GetRemotePathComponentsL( TPtrC8& aRemoteHost, TUint& aRemotePort, TPtrC8& aRemoteSessionID );
+        
+        CMSRPMessage* SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
+                                                                   const TDesC8& aFromPath, 
+                                                                   const TDesC8& aMimeType );
+    private:
+        
+        CMSRPSessionImplementation( RMSRP& aRMSRP,
+                                    MMSRPSessionObserver& aObserver );
+        
+        /** 
+         * Second phase constructor
+         * @param aIapId IAP id of the application
+         * @param aSessionId session id of this MSRP session. This comes from the
+         *        path SDP attribute where session id is used
+         */
+        void ConstructL( const TUint aIapId, const TDesC8& aSessionId );
             
-    TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
-    
-    CMSRPConnectionListener* iConnectionListener;
-    
-    CMSRPIncomingListener* iIncomingListener;
-    
-    CMSRPSendResultListener* iSendResultListener;
-    
-    RPointerArray< CMSRPMessage > iSentMessages;
-    
-    TBool iProgress;
-    
-    TBool  isSendFile;
-    TBool  isReceiveFile;
+    private:
+        
+        RMSRP& iRMSRP;
+        
+        MMSRPSessionObserver& iSessionObserver;
+
+        // session to server, owned
+        RMSRPSession* iMSRPSession;
+        
+        RBuf8 iLocalMsrpPath;
+        
+        RBuf8 iRemoteMsrpPath;
+        
+        TReportStatus iSuccessReport;
+        
+        TReportStatus iFailureReport;
+                
+        TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
+
+        // connection to other party server listener, owned
+        CMSRPConnectionListener* iConnectionListener;
+        
+        // incoming messages listener instance, owned
+        CMSRPIncomingListener* iIncomingListener;
+        
+        // result of send message request listener, owned
+        CMSRPSendResultListener* iSendResultListener;
+        
+        // array of sent messages, owned
+        RPointerArray< CMSRPMessage > iSentMessages;
     };
 
 #endif /* CMSRPSESSIONIMPLEMENTATION_H_ */
+
+// End of file
--- a/Msrp/MsrpClient/inc/MMSRPServerInterface.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/MMSRPServerInterface.h	Thu Nov 25 13:59:42 2010 +0200
@@ -33,8 +33,7 @@
     {
 public:
     
-    virtual void GetLocalPathL( TDes8 &aLocalHost,
-                               TDes8 &aSessionID ) = 0;
+    virtual void GetLocalPathL( TDes8 &aLocalHost ) = 0;
     
     virtual void Connect( const TDesC8& aRemoteHost,
                           const TUint aRemotePort,
@@ -55,9 +54,9 @@
         
     virtual TInt SendMessage( TDesC8& aMessageBuffer ) = 0;
     
-    virtual TInt CancelSending( TDesC8& aMessageId ) = 0;
+    virtual TInt CancelSending( const TDesC8& aMessageId ) = 0;
     
-    virtual void CancelReceiving( ) = 0;
+    virtual TInt CancelReceiving( const TDesC8& aMessageId ) = 0;
     virtual void CancelSendResultListening( ) = 0;
         
     virtual const TDesC8& GetMessageIdOfSentMessage() const = 0 ;
@@ -72,7 +71,18 @@
     virtual TBool GetSendProgress() const = 0;
     virtual TInt GetBytesSent() const = 0;
     virtual TInt GetTotalBytes() const = 0;
-        
+    
+    /**
+      * returns message id from incoming message
+      * @return message id
+      */
+    virtual TDesC8& ListenMessageId() = 0;
+    
+    /**
+      * returns message id from sent message
+      * @return message id
+      */
+    virtual TDesC8& SendMessageId() = 0;
     };
 
 #endif /* MMSRPSERVERINTERFACE_H_ */
--- a/Msrp/MsrpClient/inc/MMSRPSessionObserver.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/MMSRPSessionObserver.h	Thu Nov 25 13:59:42 2010 +0200
@@ -23,19 +23,32 @@
 // FORWARD DECLARATIONS
 class CMSRPMessage;
 
-
 class MMSRPSessionObserver
     {
     public:
         
         /**
-         * An MSRP SEND request has been received from the network.
+         * An MSRP message has been received from the network.
          * The content of the request is given to the client, along with the 
          * status of receiving the request. Ownership of the content is transferred.
-         * @param aMessageContent the received message content
+         * This method is used to give smaller messages to the clients in buffer
+         * @param aMessageContent the received message content, ownership is transferred
+         * @param aMimeType mimetype of the received data, ownership is transferred
          * @param aStatus KErrNone with complete message, KErrCancel if terminated
          */
-        virtual void IncomingMessage( HBufC8* aMessageContent, TInt aStatus ) = 0;
+        virtual void IncomingMessageInBuffer( HBufC8* aMessageContent, HBufC8* aMimeType, TInt aStatus ) = 0;
+
+        /**
+         * An MSRP message has been received from the network.
+         * The content of the request is given to the client, along with the 
+         * status of receiving the request. 
+         * Note: the file is a temporary file which should be moved/renamed to correct 
+         * location.
+         * @param aFileName file name and path of the received file
+         * @param aMimeType mimetype of the received file, ownership is transferred
+         * @param aStatus KErrNone with complete message, KErrCancel if terminated
+         */
+        virtual void IncomingMessageInFile( TFileName& aFileName, HBufC8* aMimeType, TInt aStatus ) = 0;
 
         /**
          * An MSRP REPORT request has been received from the network.
@@ -53,20 +66,14 @@
 
         /**
          * Result of the send operation initiated by the client
-         * @param aStatus error code as defined in MsrpCommon::TErrorCode
+         * @param aStatus error code as defined in MsrpCommon.h, TMSRPRequests
+         *        or system-wide error code
          * @param aMessageId message identifier of the sent message that
          * was returned by the SendBuffer call
          */
         virtual void SendResult( TInt aStatus, const TDesC8& aMessageid ) = 0;
 
         /**
-         * Indicates a failure in connection establishment
-         * or in case of any error in an established connection
-         * @param aStatus a system wide error code
-         */
-        virtual void ListenPortFailure( TInt aStatus ) = 0;
-
-        /**
          * Result of the connection attempt made by the client. This callback is
          * issued, both while initiating a connection with ConnectL and while
          * receiving a connection with ListenL, once the call completes.
@@ -75,31 +82,22 @@
          * @param aStatus KErrNone or a system wide error code
          */
         virtual void ConnectStatus( TInt aStatus ) = 0;
-        
-        /**
-         * Notifies that the entire file has been sent successfully 
-         */
-        virtual void SendFileNotification(TBool aStatus) = 0;
-        
+
         /**
-         * Notifies that the entire file has been received successfully 
-         */
-        virtual void ReceiveFileNotification(TBool status) = 0;
-        
-        /**
-        * File data transfer progress. returns the progress of data transfer
+        * Data transfer progress. returns the progress of data transfer
+        * @param aMessageId message identifier of the data to be sent
         * @param aTransferred number of bytes transferred
         * @param aTotal Total amount of bytes to be transferred
         */
-        virtual void FileSendProgress( TInt aTransferred, TInt aTotal ) = 0;
+        virtual void SendProgress( const TDesC8& aMessageid, TInt aTransferred, TInt aTotal ) = 0;
 
         /**
-        * File receive progress, number of bytes received from incoming data
+        * Data receive progress, number of bytes received from incoming data
+        * @param aMessageId message identifier of the data to be received
         * @param aReceived number of bytes received
         * @param aTotal Total amount of bytes to be received
         */
-        virtual void FileReceiveProgress( TInt aReceived, TInt aTotal ) = 0;
-        
+        virtual void ReceiveProgress( const TDesC8& aMessageid, TInt aReceived, TInt aTotal ) = 0;
     };
 
 #endif /* MMSRPSESSIONOBSERVER_H_ */
--- a/Msrp/MsrpClient/inc/RMSRPSession.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/inc/RMSRPSession.h	Thu Nov 25 13:59:42 2010 +0200
@@ -34,87 +34,84 @@
 
 class RMSRPSession : public RSubSessionBase, public MMSRPServerInterface
     {
-public:
-    /**
-      * constructor.
-      */
-    RMSRPSession();
-    
-public: // New functions
-    /**
-      * Opens a Sub-Session to MSRP Server
-      * @return Status of the operation
-      */
-    TInt CreateServerSubSession( RMSRP& aRMSRP, 
-                                 const TUint32 aIapId );
-    
-    void CloseServerSubSession( );
-   
-    
-public: // From base class
+    public:
+        /**
+          * constructor.
+          */
+        RMSRPSession();
+        
+    public: // New functions
+        /**
+          * Opens a Sub-Session to MSRP Server
+          * @param aRMSRP reference to main server session
+          * @param aIapId internet accesss point identifier
+          * @param aSession session id from invite
+          * @return Status of the operation
+          */
+        TInt CreateServerSubSession( RMSRP& aRMSRP, 
+                                     const TUint32 aIapId,
+                                     const TDesC8& aSessionId );
+        
+        void CloseServerSubSession( );
+        
+        /**
+          * Send a request to server whether to receive 
+          * or not to receive progress reports
+          * @param aProgress True if user wants to receive progress
+          *                  reports
+          * @return system-wide error code
+          */
+        TInt SetProgressReports( TBool aProgress );        
+        
+    public: // From MMSRPServerInterface
+        
+        void GetLocalPathL( TDes8 &aLocalHost );
+        void Connect( const TDesC8& aRemoteHost,
+                      const TUint aRemotePort,
+                      const TDesC8& aRemoteSessionID,
+                      TRequestStatus& aStatus );
+        void ListenConnections( const TDesC8& aRemoteHost,
+                                const TUint aRemotePort,
+                                const TDesC8& aRemoteSessionID,
+                                TBool aIsMessage,
+                                TRequestStatus& aStatus );
+        void ListenMessages( TBool aIsMessage,
+                             TRequestStatus& aStatus );
+        void ListenSendResult( const TDesC8& aSessionID,
+                               TRequestStatus& aStatus );
+        TInt SendMessage( TDesC8& aMessageBuffer );
+        TInt CancelSending( const TDesC8& aMessageId );
+        TInt CancelReceiving( const TDesC8& aMessageId );
+        void CancelSendResultListening( );
+        const TDesC8& GetMessageIdOfSentMessage( ) const;
+        TInt GetStatusOfSentMessage( ) const;
+        TInt GetStatusOfReceivedMessage( ) const;
+        const TDesC8& GetReceivedMessage( ) const;
+        TBool GetListenProgress() const;
+        TInt GetBytesReceived() const;
+        TInt GetTotalBytesReceived() const;
+        TBool GetSendProgress() const;
+        TInt GetBytesSent() const;
+        TInt GetTotalBytes() const;
+        TDesC8& ListenMessageId();
+        TDesC8& SendMessageId();
     
-    // From MMSRPServerInterface
-    
-    void GetLocalPathL( TDes8 &aLocalHost,
-                       TDes8 &aSessionID );
-    
-    void Connect( const TDesC8& aRemoteHost,
-                  const TUint aRemotePort,
-                  const TDesC8& aRemoteSessionID,
-                  TRequestStatus& aStatus );
+    private: //variables
         
-    void ListenConnections( const TDesC8& aRemoteHost,
-                            const TUint aRemotePort,
-                            const TDesC8& aRemoteSessionID,
-                            TBool aIsMessage,
-                            TRequestStatus& aStatus );
-    
-    void ListenMessages( TBool aIsMessage,
-                         TRequestStatus& aStatus );
-    
-    void ListenSendResult( const TDesC8& aSessionID,
-                           TRequestStatus& aStatus );
+        // Local path data to be recived from the server
+        TPckgBuf< TLocalPathMSRPData > iLocalPathMSRPDataPckg;
             
-    TInt SendMessage( TDesC8& aMessageBuffer );
-        
-    TInt CancelSending( TDesC8& aMessageId );
-    
-    void CancelReceiving( );
-    void CancelSendResultListening( );
+        // Connection data to be sent to server
+        TPckgBuf< TConnectMSRPData > iConnectMSRPDataPckg;
         
-    const TDesC8& GetMessageIdOfSentMessage( ) const;
-    TInt GetStatusOfSentMessage( ) const;
-    TInt GetStatusOfReceivedMessage( ) const;
-    const TDesC8& GetReceivedMessage( ) const;
-    
-    TBool GetListenProgress() const;
-    TInt GetBytesReceived() const;
-    TInt GetTotalBytesReceived() const;
+        // Message sending data to be sent to server
+        TPckgBuf< TSendMSRPData > iSendMSRPDataPckg;
     
-    TBool GetSendProgress() const;
-    TInt GetBytesSent() const;
-    TInt GetTotalBytes() const;
-
-    
-    TInt SendFileL(TDesC8& aFileParamBuffer);
-    TInt ReceiveFileL(TDesC8& aFileParamBuffer);
-private: //variables
+        // Listen for incoming messages data package
+        TPckgBuf< TListenMSRPData > iListenMSRPDataPckg;
     
-    // Local path data to be recived from the server
-    TPckgBuf< TLocalPathMSRPData > iLocalPathMSRPDataPckg;
-        
-    // Connection data to be sent to server
-    TPckgBuf< TConnectMSRPData > iConnectMSRPDataPckg;
-    
-    // Message sending data to be sent to server
-    TPckgBuf< TSendMSRPData > iSendMSRPDataPckg;
-
-    // Listen for incoming messages data package
-    TPckgBuf< TListenMSRPData > iListenMSRPDataPckg;
-
-    // Listen for response to sent messages data package
-    TPckgBuf< TListenSendResultMSRPData > iSendResultListenMSRPDataPckg;
-        
+        // Listen for response to sent messages data package
+        TPckgBuf< TListenSendResultMSRPData > iSendResultListenMSRPDataPckg;
     };
 
 #endif /* RMSRPSESSION_H_ */
--- a/Msrp/MsrpClient/src/CMSRP.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRP.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -52,8 +52,10 @@
 		delete iMSRPImpl;
     }
 
-EXPORT_C CMSRPSession* CMSRP::CreateMSRPSessionL( MMSRPSessionObserver& aObserver, 
-                                                 const TUint aIapId )
+EXPORT_C CMSRPSession* CMSRP::CreateMSRPSessionL( 
+    MMSRPSessionObserver& aObserver, 
+    const TUint aIapId,
+    const TDesC8& aSessionId )
 	{
 		// Creates and Returns a MSRP Session. 
 		// No paramers are taken at this stage. Primarily because 
@@ -64,7 +66,7 @@
 	
 	MSRPLOG("CMSRP.. Create MSRP session");
 
-	return iMSRPImpl->CreateMSRPSessionL( aObserver, aIapId );
+	return iMSRPImpl->CreateMSRPSessionL( aObserver, aIapId, aSessionId );
 	}
 
 EXPORT_C void CMSRP::CloseMSRPSession( CMSRPSession* aMsrpSession )
--- a/Msrp/MsrpClient/src/CMSRPImplementation.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRPImplementation.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -78,8 +78,10 @@
 	}
  
  
-CMSRPSession* CMSRPImplementation::CreateMSRPSessionL( MMSRPSessionObserver& aObserver,
-                                                       const TUint aIapId )
+CMSRPSession* CMSRPImplementation::CreateMSRPSessionL( 
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
 	{
 	// Creates and Returns a MSRP Session. 
 	// No paramers are taken at this stage. Primarily because 
@@ -91,7 +93,7 @@
 	MSRPLOG("CMSRP Impl.. Create MSRP session");
 
 	CMSRPSession* msrpSession 
-	 			= CMSRPSession::NewL( *iMSRP, aObserver, aIapId );
+	 			= CMSRPSession::NewL( *iMSRP, aObserver, aIapId, aSessionId );
 
 	// CMSRPImplementation would like to keep a tab on number of MSRP sessions 
 	// that it is serving.Append the MSRPSession to a session array.
--- a/Msrp/MsrpClient/src/CMSRPIncomingListener.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRPIncomingListener.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -94,7 +94,7 @@
             if(iServerInterface.GetListenProgress())
                 {
                 //handle listen progress
-                iSessionImpl.ReceiveProgress(iServerInterface.GetBytesReceived(), iServerInterface.GetTotalBytesReceived());                       
+                iSessionImpl.ReceiveProgress( iServerInterface.ListenMessageId(), iServerInterface.GetBytesReceived(), iServerInterface.GetTotalBytesReceived());                       
                 }
             else
                 {
@@ -120,7 +120,7 @@
     {
     if ( IsActive() )
         {
-        iServerInterface.CancelReceiving();
+        TBuf8<1> empty; // cancel all
+        iServerInterface.CancelReceiving( empty );
         }
-   
     }
--- a/Msrp/MsrpClient/src/CMSRPSendResultListener.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRPSendResultListener.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -85,7 +85,7 @@
         {
         if(iServerInterface.GetSendProgress())
             {
-            iSessionImpl.SendProgress(iServerInterface.GetBytesSent(), iServerInterface.GetTotalBytes());
+            iSessionImpl.SendProgress( iServerInterface.SendMessageId(), iServerInterface.GetBytesSent(), iServerInterface.GetTotalBytes());
             //handle send progress
             //to session observer                           
             }
--- a/Msrp/MsrpClient/src/CMSRPSession.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRPSession.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -17,68 +17,92 @@
 // System Includes
 #include <e32base.h>
 
-
 //  Include Files
 #include "CMSRPSession.h"
 #include "CMSRPSessionImplementation.h"
 
-
-//  Member Functions
-
-CMSRPSession* CMSRPSession::NewL( RMSRP& aRMSRP,
-                                           MMSRPSessionObserver& aObserver,
-                                           const TUint aIapId )
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+CMSRPSession* CMSRPSession::NewL( 
+    RMSRP& aRMSRP,
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
 	{
 	MSRPLOG("CMSRP Session.. NewL");
-	CMSRPSession* self = CMSRPSession::NewLC( aRMSRP, aObserver, aIapId );
+	CMSRPSession* self = CMSRPSession::NewLC( aRMSRP, aObserver, aIapId, aSessionId );
 	CleanupStack::Pop(self);
 	return self;
 	}
 
-
-CMSRPSession* CMSRPSession::NewLC( RMSRP& aRMSRP,
-                                            MMSRPSessionObserver& aObserver,
-                                            const TUint aIapId )
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+CMSRPSession* CMSRPSession::NewLC( 
+    RMSRP& aRMSRP,
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
     {
     MSRPLOG("CMSRP Session.. NewLC");
     CMSRPSession* self = new (ELeave) CMSRPSession;
     CleanupStack::PushL(self);
-    self->ConstructL( aRMSRP, aObserver, aIapId );
+    self->ConstructL( aRMSRP, aObserver, aIapId, aSessionId );
     return self;
     }
 
-
-void CMSRPSession::ConstructL( RMSRP& aRMSRP,
-                               MMSRPSessionObserver& aObserver,
-                               const TUint aIapId )
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+void CMSRPSession::ConstructL( 
+    RMSRP& aRMSRP,
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
 	{
 	MSRPLOG("CMSRP Session.. ConstructL");
-	iMSRPSessionImpl = CMSRPSessionImplementation::NewL( aRMSRP, aObserver, aIapId );	 
+	iMSRPSessionImpl = CMSRPSessionImplementation::NewL( aRMSRP, aObserver, aIapId, aSessionId );	 
 	}
 
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 CMSRPSession::~CMSRPSession()
 	{
-	MSRPLOG("CMSRP Session.. Dtor");
-	if(NULL != iMSRPSessionImpl)
-		delete iMSRPSessionImpl;
+	MSRPLOG("-> CMSRPSession::~CMSRPSession()");
+	delete iMSRPSessionImpl;
+    MSRPLOG("<- CMSRPSession::~CMSRPSession()");
 	}
 
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C TDesC8& CMSRPSession::LocalMSRPPath()
     {
     MSRPLOG("CMSRP Session.. LocalMSRPPath");
     return iMSRPSessionImpl->LocalMSRPPath();
     }
 
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C void CMSRPSession::SetSessionParams( CMSRPSessionParams& aSessionParams )
     {
     MSRPLOG("CMSRP Session.. SetSessionParams");
     iMSRPSessionImpl->SetSessionParams( aSessionParams );
     }
 
-    
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C TInt CMSRPSession::Connect( const TDesC8& aRemoteMsrpPath )
 	{
 	MSRPLOG("CMSRP Session.. Connect");
@@ -86,7 +110,10 @@
 	return err;
 	}
 
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C TInt CMSRPSession::Listen( const TDesC8& aRemoteMsrpPath )
 	{
 	MSRPLOG("CMSRP Session.. Listen");
@@ -94,7 +121,10 @@
 	return err;
 	}
 
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C HBufC8* CMSRPSession::SendBuffer(
     const TDesC8& aMessage,
     const TDesC8& aMimeType )
@@ -105,50 +135,54 @@
     TRAPD( err, messageId = iMSRPSessionImpl->SendBufferL( aMessage, aMimeType ) );
     if ( err )
         {
-        return NULL;
+        messageId = NULL;
         }
     return messageId;
     }
 
-EXPORT_C TInt CMSRPSession::SendFile(
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC8* CMSRPSession::SendFile(
     const TFileName& aFileName,
     const TDesC8& aMimeType )
     {
    
     MSRPLOG("CMSRP Session.. SendFile");
-    TRAPD( err,iMSRPSessionImpl->SendFileL(aFileName, aMimeType ) );
-    return err;
-    
+    HBufC8* messageId = NULL;
+    TRAPD( err, messageId = iMSRPSessionImpl->SendFileL(aFileName, aMimeType ) );
+    if ( err )
+        {
+        messageId = NULL;
+        }
+    return messageId;
     }
 
-EXPORT_C TInt CMSRPSession::CancelFileSending( )
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSRPSession::CancelReceiving( TDesC8& aMessageId )
     {
-    MSRPLOG("CMSRP Session.. CancelFileSending");
-/*    TInt err;
-    return err;*/
-    return 0;
-    }
-
-EXPORT_C TInt CMSRPSession::ReceiveFile(
-        const TFileName& aFileName,
-        const TInt aFileSize,
-        const TDesC8& aMimeType)
-    {
-    MSRPLOG("CMSRP Session.. ReceiveFile");
-    TRAPD( err,iMSRPSessionImpl->ReceiveFileL(aFileName,aFileSize,aMimeType ));
+    MSRPLOG("-> CMSRPSession::CancelReceiveFile");
+    TRAPD( err, iMSRPSessionImpl->CancelReceivingL( aMessageId ) );
     return err;
     }
 
-EXPORT_C TInt CMSRPSession::CancelReceiveFile()
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMSRPSession::NotifyProgress(TBool aFlag)
     {
-    return 0;
+    iMSRPSessionImpl->NotifyProgress( aFlag );
     }
 
-EXPORT_C void CMSRPSession::NotifyProgress(TBool aFlag)
-    {
-    iMSRPSessionImpl->NotifyProgress(aFlag);
-    }
-
+// -----------------------------------------------------------------------------
+// CMSRPSession::NewL
+// -----------------------------------------------------------------------------
+//
 EXPORT_C TInt CMSRPSession::CancelSending( TDesC8& aMessageId )
     {
     MSRPLOG("CMSRP Session.. CancelSending");
@@ -156,3 +190,4 @@
     return err;
     }
 
+// End of File
--- a/Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -24,6 +24,7 @@
 #include "CMSRPIncomingListener.h"
 #include "CMSRPSendResultListener.h"
 #include "CMSRPMessage.h"
+#include "CMSRPReport.h"
 #include "CMSRPToPathHeader.h"
 #include "CMSRPFromPathHeader.h"
 #include "CMSRPMessageIdHeader.h"
@@ -31,6 +32,8 @@
 #include "CMsrpFailureReportHeader.h"
 #include "CMsrpContentTypeHeader.h"
 #include "CMSRPSessionParams.h"
+#include "CMSRPStatusHeader.h"
+#include "CMSRPByteRangeHeader.h"
 
 
 // SYSTEM INCLUDES
@@ -43,27 +46,32 @@
 
 //  Member Functions
 
-CMSRPSessionImplementation* CMSRPSessionImplementation::NewL( RMSRP& aRMSRP,
-                                                              MMSRPSessionObserver& aObserver,
-                                                              const TUint aIapId )
+CMSRPSessionImplementation* CMSRPSessionImplementation::NewL( 
+    RMSRP& aRMSRP,
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
 	{
 	MSRPLOG("CMSRPSessionImplementation::NewL");
-	CMSRPSessionImplementation *self = CMSRPSessionImplementation::NewLC( aRMSRP, aObserver, aIapId );
+	CMSRPSessionImplementation *self = CMSRPSessionImplementation::NewLC( 
+	        aRMSRP, aObserver, aIapId, aSessionId );
 
 	CleanupStack::Pop(self);
 	return self;
 	}
 
 
-CMSRPSessionImplementation* CMSRPSessionImplementation::NewLC( RMSRP& aRMSRP,
-                                                               MMSRPSessionObserver& aObserver,
-                                                               const TUint aIapId )
+CMSRPSessionImplementation* CMSRPSessionImplementation::NewLC( 
+    RMSRP& aRMSRP,
+    MMSRPSessionObserver& aObserver,
+    const TUint aIapId,
+    const TDesC8& aSessionId )
     {
     MSRPLOG("CMSRPSessionImplementation::NewLC");
     CMSRPSessionImplementation *self = new (ELeave) CMSRPSessionImplementation( aRMSRP, aObserver );                                                            
 
     CleanupStack::PushL(self);                                                       
-    self->ConstructL( aIapId );
+    self->ConstructL( aIapId, aSessionId );
     return self;
     }
 
@@ -78,45 +86,41 @@
 	}
 
 
-void CMSRPSessionImplementation::ConstructL( const TUint aIapId )
+void CMSRPSessionImplementation::ConstructL( const TUint aIapId, const TDesC8& aSessionId )
 	{
 	MSRPLOG("CMSRPSessionImplementation::ConstructL enter");
 	
 	MSRPStrings::OpenL();
 	iMSRPSession = new ( ELeave ) RMSRPSession();
 	    
-	User::LeaveIfError(iMSRPSession->CreateServerSubSession( iRMSRP, aIapId ) );
+	User::LeaveIfError(iMSRPSession->CreateServerSubSession( iRMSRP, aIapId, aSessionId ) );
 	MSRPLOG("Sub session opened successfully!");
 		
-	RBuf8 sessionID;
-	sessionID.CreateL( KMaxLengthOfSessionId );
-	CleanupClosePushL( sessionID );
-	
 	RBuf8 localHost;
 	localHost.CreateL( KMaxLengthOfHost );
 	CleanupClosePushL( localHost );
 	
-	iMSRPSession->GetLocalPathL( localHost, sessionID );
+	iMSRPSession->GetLocalPathL( localHost );
 	
-	iLocalMsrpPath.CreateL( KMsrpUriScheme, KMsrpFixedLength + localHost.Length() + sessionID.Length() );
+	iLocalMsrpPath.CreateL( KMsrpUriScheme, KMsrpFixedLength + localHost.Length() + aSessionId.Length() );
 		
 	iLocalMsrpPath.Append( localHost );
 	iLocalMsrpPath.Append( KColon );
 	iLocalMsrpPath.AppendNum( KMsrpPort );
 	iLocalMsrpPath.Append( KForwardSlash );   
-	iLocalMsrpPath.Append( sessionID );
+	iLocalMsrpPath.Append( aSessionId );
 	iLocalMsrpPath.Append( KSemicolon );
 	iLocalMsrpPath.Append( KTransport );
 	
 	
 	iConnectionListener = CMSRPConnectionListener::NewL(
 	        *this, *iMSRPSession );
+	iSendResultListener = CMSRPSendResultListener::NewL(
+	        *this, *iMSRPSession, aSessionId );
 	iIncomingListener = CMSRPIncomingListener::NewL(
-	        *this, *iMSRPSession );
-	iSendResultListener = CMSRPSendResultListener::NewL(
-	        *this, *iMSRPSession, sessionID );
+            *this, *iMSRPSession );
 	
-	CleanupStack::PopAndDestroy(2); //sessionID and localHost
+	CleanupStack::PopAndDestroy( ); // localHost
 	MSRPLOG("CMSRPSessionImplementation::ConstructL exit");
 	}
 
@@ -124,7 +128,7 @@
 CMSRPSessionImplementation::~CMSRPSessionImplementation()
     {
     MSRPLOG("CMSRPSessionImplementation::Dtor Entered");
-        
+    
     MSRPStrings::Close();
     iLocalMsrpPath.Close();
     iRemoteMsrpPath.Close();
@@ -217,8 +221,7 @@
 
 
 void CMSRPSessionImplementation::ConnectionEstablishedL( TInt aStatus )
-    {
-    
+    {    
     MSRPLOG("CMSRPSessionImplementation::ConnectionEstablished enter");
     
     iSessionObserver.ConnectStatus(aStatus);
@@ -228,7 +231,7 @@
         iIncomingListener->ListenMessages( );
 
         // start listening when message has been sent,  to responses
-        iSendResultListener->ListenSendResultL( );                
+        iSendResultListener->ListenSendResultL( );        
         }
     
     MSRPLOG("CMSRPSessionImplementation::ConnectionEstablished exit");
@@ -248,24 +251,60 @@
         CMSRPMessage* message = NULL;
         message = CMSRPMessage::InternalizeL( readStream );
         CleanupStack::PushL(message);
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, content = %d", message->IsContent()  )
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, FN = %S", &message->GetFileName()  )
         
-        HBufC8* messageContent = NULL;
-        if(message->IsContent())
+        HBufC8* contentType = NULL;
+        if( message->IsContent() )
             {
-            messageContent = HBufC8::NewL(message->Content().Length());
-            CleanupStack::PushL( messageContent );
-            *messageContent = message->Content();
+            HBufC8* messageContent = NULL;
+            if ( message->Content().Length() )
+                {
+                messageContent = HBufC8::NewL(message->Content().Length());
+                CleanupStack::PushL( messageContent );
+                *messageContent = message->Content();
+                }
+            else
+                {
+                messageContent = HBufC8::NewL(KNullDesC8().Length());
+                CleanupStack::PushL( messageContent );
+                *messageContent = KNullDesC8();
+                }
+            
+            if( message->ContentTypeHeader() )
+                {
+                contentType = message->ContentTypeHeader()->ToTextValueLC();
+                CleanupStack::Pop();
+                }
+
+            iSessionObserver.IncomingMessageInBuffer( messageContent, contentType, aStatus );
+            CleanupStack::Pop( messageContent );
             }
         else
             {
-            messageContent = HBufC8::NewL(KNullDesC8().Length());
-            CleanupStack::PushL( messageContent );
-            *messageContent = KNullDesC8();
+            if( message->ContentTypeHeader() )
+                {
+                contentType = message->ContentTypeHeader()->ToTextValueLC();
+                CleanupStack::Pop();
+                }
+            iSessionObserver.IncomingMessageInFile( message->GetFileName(), contentType, aStatus );
             }
+        CleanupStack::PopAndDestroy( message );
+        }
+    else if ( CMSRPReport::IsReport( aIncomingMessage ) )
+        {
+        CMSRPReport* report = CMSRPReport::InternalizeL( readStream );
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, status = %d", report->StatusHeader()->StatusCode() )
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, startpos = %d", report->ByteRangeHeader()->StartPosition() )
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, endpos = %d", report->ByteRangeHeader()->EndPosition() )
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, total = %d", report->ByteRangeHeader()->TotalLength() )
 
-        iSessionObserver.IncomingMessage( messageContent, aStatus );
-        CleanupStack::Pop( messageContent );
-        CleanupStack::PopAndDestroy(message);
+        iSessionObserver.IncomingReport(
+            report->StatusHeader()->StatusCode(),
+            report->ByteRangeHeader()->StartPosition(),
+            report->ByteRangeHeader()->EndPosition(),
+            report->ByteRangeHeader()->TotalLength() );
+        delete report;
         }
     else
         {
@@ -275,16 +314,25 @@
     MSRPLOG( "CMSRPSessionImplementation::HandleIncomingMessageL exit" )
     }
 
-void CMSRPSessionImplementation::ReceiveProgress(TInt aBytesReceived, TInt aTotalBytes)
+
+void CMSRPSessionImplementation::ReceiveProgress( 
+    const TDesC8& aMessageId, 
+    TInt aBytesReceived, 
+    TInt aTotalBytes )
     {
-    iSessionObserver.FileReceiveProgress(aBytesReceived, aTotalBytes);
+    iSessionObserver.ReceiveProgress( aMessageId, aBytesReceived, aTotalBytes);
     }
 
-void CMSRPSessionImplementation::SendProgress(TInt aBytesSent, TInt aTotalBytes)
+
+void CMSRPSessionImplementation::SendProgress( 
+    const TDesC8& aMessageId,
+    TInt aBytesSent, 
+    TInt aTotalBytes )
     {
-    iSessionObserver.FileSendProgress(aBytesSent, aTotalBytes);    
+    iSessionObserver.SendProgress( aMessageId, aBytesSent, aTotalBytes);    
     }
 
+
 CMSRPMessage* CMSRPSessionImplementation::CreateMsrpMessageL(
     const TDesC8& aMessage, const TDesC8& aToPath,
     const TDesC8& aFromPath, const TDesC8& aMimeType )
@@ -345,14 +393,14 @@
         CMSRPContentTypeHeader* contentType = CMSRPContentTypeHeader::NewL( aMimeType );
         msrpMessage->SetContentTypeHeader( contentType );
         
-        if(aMessage.Length())
+        if( aMessage.Length() )
             {
             // content of the message
             HBufC8* contentOfMessage = HBufC8::NewL( aMessage.Length() );
             *contentOfMessage = aMessage;
 
             msrpMessage->SetContent( contentOfMessage );
-            }        
+            }
         }
     
     CleanupStack::Pop(msrpMessage);
@@ -373,7 +421,7 @@
         User::Leave( KErrArgument );
         }
 
-    CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256
+    CBufSeg* buf1 = CBufSeg::NewL( KBufExpandSize );
     CleanupStack::PushL( buf1 );
     RBufWriteStream writeStream( *buf1 );
     CleanupClosePushL( writeStream );
@@ -405,11 +453,6 @@
     {
     MSRPLOG( "CMSRPSessionImplementation::SendBufferL enter" )
     
-    if(aMessage.Length() && !aMimeType.Length())
-        {
-        User::Leave( KErrArgument );
-        }
-    
     CMSRPMessage* msrpMessage = CreateMsrpMessageL(
                                 aMessage, iRemoteMsrpPath, iLocalMsrpPath, aMimeType );
     CleanupStack::PushL( msrpMessage );
@@ -429,71 +472,62 @@
     User::LeaveIfError( iMSRPSession->CancelSending( aMessageId ) );
     }
 
+void CMSRPSessionImplementation::CancelReceivingL( TDesC8& aMessageId )
+    {
+    MSRPLOG( "CMSRPSessionImplementation::CancelReceivingL " )
+    // then let's send a message to server to cancel receiving
+    User::LeaveIfError( iMSRPSession->CancelReceiving( aMessageId ) );
+    }
 
 void CMSRPSessionImplementation::SendStatusL( TInt aStatus, const TDesC8& aMessageid )
     {
     MSRPLOG2( "CMSRPSessionImplementation::SendStatus = %d", aStatus )
-    if(isReceiveFile || isSendFile )
-        {
-        if(isReceiveFile)
-            {
-            iSessionObserver.ReceiveFileNotification( aStatus );
-           
-            }
-        if(isSendFile)
-            {
-            iSessionObserver.SendFileNotification( aStatus );
-            }
-        }
-     else
+    for ( TInt i = 0; i < iSentMessages.Count(); i++ )
         {
-        for ( TInt i = 0; i < iSentMessages.Count(); i++ )
+        HBufC8* messageid = iSentMessages[ i ]->MessageIdHeader()->ToTextValueLC();
+        if ( *messageid == aMessageid )
             {
-            HBufC8* messageid = iSentMessages[ i ]->MessageIdHeader()->ToTextValueLC();
-            if ( *messageid == aMessageid )
-                {
-                // match
-                delete iSentMessages[ i ];
-                iSentMessages.Remove( i );
-                iSessionObserver.SendResult( aStatus, aMessageid );
-                CleanupStack::PopAndDestroy(messageid); // messageid from above
-                break;
-                }
+            // match
+            delete iSentMessages[ i ];
+            iSentMessages.Remove( i );
+            iSessionObserver.SendResult( aStatus, aMessageid );
             CleanupStack::PopAndDestroy(messageid); // messageid from above
+            break;
             }
+        CleanupStack::PopAndDestroy(messageid); // messageid from above
         }
-
+        
     MSRPLOG( "CMSRPSessionImplementation::SendStatus exit" )
     }
 
 void CMSRPSessionImplementation::HandleConnectionErrors( TInt aErrorStatus )
     {
     MSRPLOG2( "CMSRPSessionImplementation::HandleConnectionErrors Error = %d", aErrorStatus )
-    iSessionObserver.ListenPortFailure(aErrorStatus);  
-    
+    iSessionObserver.ConnectStatus(aErrorStatus);      
     }
 
-void CMSRPSessionImplementation::SendFileL(const TFileName& aFileName, const TDesC8& aMimeType)
+
+HBufC8* CMSRPSessionImplementation::SendFileL(const TFileName& aFileName, const TDesC8& aMimeType)
     {
-    MSRPLOG( "CMSRPSessionImplementation::SendFileL enter" );
-   
+    MSRPLOG( "CMSRPSessionImplementation::SendFileL enter" );   
+    
     if(aFileName.Length() && !aMimeType.Length())
         {
         User::Leave( KErrArgument );
         }
-     isSendFile = ETrue;
-    CMSRPMessage* iFile = SetFileParamsL(aFileName,iRemoteMsrpPath, iLocalMsrpPath,aMimeType );
+    CMSRPMessage* file = SetFileParamsL( aFileName,iRemoteMsrpPath, iLocalMsrpPath,aMimeType );
+    CleanupStack::PushL( file );
     
-     //Set progress indication
-    iFile->SetNotifyProgress(iProgress);
-     
-    CBufSeg* buf = CBufSeg::NewL( 100 ); // expandsize to 100 
+    iSentMessages.AppendL( file );
+    CleanupStack::Pop(); // file
+    
+    CBufSeg* buf = CBufSeg::NewL( KBufExpandSize ); 
     
     //todo need to check what's optimal value here
     CleanupStack::PushL( buf );
     RBufWriteStream writeStr( *buf );
     CleanupClosePushL( writeStr );
-    iFile->ExternalizeL( writeStr );
+    file->ExternalizeL( writeStr );
     writeStr.CommitL();
     
     // MSRP message externalized to buffer, now let's move it to flat buffer
@@ -504,130 +538,93 @@
         }
 
     buf->Read( 0, iExtMessageBuffer, buf->Size() );
+    HBufC8* messageId = file->MessageIdHeader()->ToTextValueLC();
+    CleanupStack::Pop(); // messageid
     CleanupStack::PopAndDestroy( 2 ); // buf, writestream
-   
-    delete iFile;
-	iFile = NULL;
-    // send the filename
-   User::LeaveIfError( iMSRPSession->SendFileL( iExtMessageBuffer ) );
-   MSRPLOG( "CMSRPSessionImplementation::SendFileL exit" ); 
-    }  
-    
-void CMSRPSessionImplementation::ReceiveFileL(const TFileName& aFileName,const TInt aFileSize, const TDesC8& aMimeType)
-    {
-    MSRPLOG( "CMSRPSessionImplementation::ReceiveFileL enter" );
-    isReceiveFile = ETrue;
-    if(aFileName.Length() && !aMimeType.Length())
-            {
-            User::Leave( KErrArgument );
-            }
-    CMSRPMessage* iFile = SetFileParamsL(aFileName,iRemoteMsrpPath, iLocalMsrpPath,aMimeType );
-       
-       //Set FileSize
-       iFile->SetFileSize(aFileSize);
+    CleanupStack::PushL( messageId );
        
-       //Set progress indication
-       iFile->SetNotifyProgress(iProgress);
-        
-       CBufSeg* buf = CBufSeg::NewL( 100 ); // expandsize to 100 
-       
-       //todo need to check what's optimal value here
-       CleanupStack::PushL( buf );
-       RBufWriteStream writeStr( *buf );
-       CleanupClosePushL( writeStr );
-       iFile->ExternalizeL( writeStr );
-       writeStr.CommitL();
-       
-       // MSRP message externalized to buffer, now let's move it to flat buffer
-       if ( buf->Size() > KMaxLengthOfIncomingMessageExt )
-           {
-           // invalid message size
-           User::Leave( KErrArgument );
-           }
-
-       buf->Read( 0, iExtMessageBuffer, buf->Size() );
-       CleanupStack::PopAndDestroy( 2 ); // buf, writestream
-       
-       delete iFile;
-	   iFile = NULL;
-          // send the filename
-          User::LeaveIfError( iMSRPSession->ReceiveFileL( iExtMessageBuffer ) );
-       
-       
-    }
+    // send the filename
+    User::LeaveIfError( iMSRPSession->SendMessage( iExtMessageBuffer ) );
+    CleanupStack::Pop( messageId ); 
+    
+    MSRPLOG( "CMSRPSessionImplementation::SendFileL exit" );
+    return messageId;
+    }  
 
 CMSRPMessage* CMSRPSessionImplementation::SetFileParamsL(const TFileName& aFileName,const TDesC8& aToPath,
                                                         const TDesC8& aFromPath, 
                                                         const TDesC8& aMimeType )
     {
-      MSRPLOG( "CMSRPSessionImplementation::SetFileParamsL enter" );
+    MSRPLOG( "CMSRPSessionImplementation::SetFileParamsL enter" );
+    
+    CMSRPMessage* msrpMessage = new ( ELeave ) CMSRPMessage();
+    CleanupStack::PushL( msrpMessage );
+    
+    //set filename
+    msrpMessage->SetFileName( aFileName );
     
-      CMSRPMessage* msrpMessage = new ( ELeave ) CMSRPMessage();
-      CleanupStack::PushL( msrpMessage );
+    //set to path
+    CMSRPToPathHeader* toPath = CMSRPToPathHeader::DecodeL( aToPath );
+    msrpMessage->SetToPathHeader( toPath );
     
-      //set filename
-      msrpMessage->SetFileName( aFileName );
+    //set from path
+    CMSRPFromPathHeader* fromPath = CMSRPFromPathHeader::DecodeL( aFromPath );
+    msrpMessage->SetFromPathHeader( fromPath );
     
-      //set to path
-      CMSRPToPathHeader* toPath = CMSRPToPathHeader::DecodeL( aToPath );
-      msrpMessage->SetToPathHeader( toPath );
-
-      //set from path
-      CMSRPFromPathHeader* fromPath = CMSRPFromPathHeader::DecodeL( aFromPath );
-      msrpMessage->SetFromPathHeader( fromPath );
-
-      //set content type
-      if(aMimeType.Length())
-          {
-          CMSRPContentTypeHeader* contentType = CMSRPContentTypeHeader::NewL( aMimeType );
-          msrpMessage->SetContentTypeHeader( contentType );
-          }
-      
-      //set  message id header
-      TTime now;
-      now.HomeTime();
-      TInt64 seed = now.Int64();
-      // Create a random number as the session ID
-      TInt random = Math::Rand( seed );
-      TBuf8< 100 > idString;
-      idString.AppendNum( random );
-      CMSRPMessageIdHeader* messageIdHeader = CMSRPMessageIdHeader::NewL( idString );
-      msrpMessage->SetMessageIdHeader( messageIdHeader );
+    //set content type
+    if(aMimeType.Length())
+      {
+      CMSRPContentTypeHeader* contentType = CMSRPContentTypeHeader::NewL( aMimeType );
+      msrpMessage->SetContentTypeHeader( contentType );
+      }
+    
+    //set  message id header
+    TTime now;
+    now.HomeTime();
+    TInt64 seed = now.Int64();
+    // Create a random number as the session ID
+    TInt random = Math::Rand( seed );
+    TBuf8< 100 > idString;
+    idString.AppendNum( random );
+    CMSRPMessageIdHeader* messageIdHeader = CMSRPMessageIdHeader::NewL( idString );
+    msrpMessage->SetMessageIdHeader( messageIdHeader );
       
       // success report header
-        if( iSuccessReport != ENo )
-            {
-            RStringF string = MSRPStrings::StringF( MSRPStrConsts::EYes );
-            CMSRPSuccessReportHeader* successReportHeader = CMSRPSuccessReportHeader::NewL( string );
-            msrpMessage->SetSuccessReportHeader( successReportHeader );
-            }
-        
-        // failure report header
-        if( iFailureReport != EYes )
+    if( iSuccessReport != ENo )
+        {
+        RStringF string = MSRPStrings::StringF( MSRPStrConsts::EYes );
+        CMSRPSuccessReportHeader* successReportHeader = CMSRPSuccessReportHeader::NewL( string );
+        msrpMessage->SetSuccessReportHeader( successReportHeader );
+        }
+    
+    // failure report header
+    if( iFailureReport != EYes )
+        {
+        RStringF string;
+        CleanupClosePushL(string);
+        if( iFailureReport == ENo )
             {
-            RStringF string;
-            CleanupClosePushL(string);
-            if( iFailureReport == ENo )
-                {
-                string = MSRPStrings::StringF( MSRPStrConsts::ENo );
-                }
-            else
-                {
-                string = MSRPStrings::StringF( MSRPStrConsts::EPartial );
-                }
-            CMSRPFailureReportHeader* failureReportHeader = CMSRPFailureReportHeader::NewL( string );
-            msrpMessage->SetFailureReportHeader( failureReportHeader );
-            CleanupStack::PopAndDestroy(); // string
+            string = MSRPStrings::StringF( MSRPStrConsts::ENo );
+            }
+        else
+            {
+            string = MSRPStrings::StringF( MSRPStrConsts::EPartial );
             }
-      
-          CleanupStack::Pop(msrpMessage); // msrpMessage
+        CMSRPFailureReportHeader* failureReportHeader = CMSRPFailureReportHeader::NewL( string );
+        msrpMessage->SetFailureReportHeader( failureReportHeader );
+        CleanupStack::PopAndDestroy(); // string
+        }
+    
+    CleanupStack::Pop(msrpMessage); // msrpMessage
          
-     MSRPLOG( "CMSRPSessionImplementation::SetFileParamsL enter" );
-	 return msrpMessage;
+    MSRPLOG( "CMSRPSessionImplementation::SetFileParamsL enter" );
+	return msrpMessage;
     }
 
 
 void CMSRPSessionImplementation::NotifyProgress(TBool aFlag)
     {
-     iProgress = aFlag;
+    iMSRPSession->SetProgressReports( aFlag );
     }
+
+// End of file
--- a/Msrp/MsrpClient/src/RMSRPSession.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpClient/src/RMSRPSession.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -33,11 +33,17 @@
     }
 
 
-TInt RMSRPSession::CreateServerSubSession( RMSRP& aRMSRP, const TUint32 aIapId )
+TInt RMSRPSession::CreateServerSubSession( 
+    RMSRP& aRMSRP, 
+    const TUint32 aIapId,
+    const TDesC8& aSessionId )
     {
     MSRPLOG("RMSRP Session.. Create client-server SubSession");
+    TBuf<200 > koe;
+    koe.Copy( aSessionId );
+    MSRPLOG2("RMSRP Session.. Create client-server SubSession, %S", &koe );
     
-    return CreateSubSession( aRMSRP, EMSRPCreateSubSession, TIpcArgs( aIapId ) );
+    return CreateSubSession( aRMSRP, EMSRPCreateSubSession, TIpcArgs( aIapId, &aSessionId ) );
     }
 
 
@@ -48,14 +54,13 @@
     }
 
 
-void RMSRPSession::GetLocalPathL( TDes8 &aLocalHost, TDes8 &aSessionID )
+void RMSRPSession::GetLocalPathL( TDes8 &aLocalHost )
     {
     MSRPLOG("RMSRP Session.. GetLocalPath");
     
     User::LeaveIfError( SendReceive(EMSRPLocalPath, TIpcArgs( &iLocalPathMSRPDataPckg )) );
     
     aLocalHost = iLocalPathMSRPDataPckg().iLocalHost;
-    aSessionID = iLocalPathMSRPDataPckg().iSessionID;    
     }
 
 
@@ -87,7 +92,8 @@
     iListenMSRPDataPckg().iRemoteSessionID = aRemoteSessionID;
     iListenMSRPDataPckg().iIsMessage = aIsMessage;
         
-    SendReceive( EMSRPListenConnections, TIpcArgs( &iListenMSRPDataPckg ), aStatus );    
+    SendReceive( EMSRPListenConnections, TIpcArgs( &iListenMSRPDataPckg ), aStatus );   
+    SendReceive( EMSRPProcessQueuedRequests );
     }
 
 
@@ -122,18 +128,17 @@
     }
 
 
-TInt RMSRPSession::CancelSending( TDesC8& aMessageId )
+TInt RMSRPSession::CancelSending( const TDesC8& aMessageId )
     {
     MSRPLOG("RMSRP Session.. CancelSending");
     return SendReceive( EMSRPCancelSending, TIpcArgs( &aMessageId ) );
     }
 
 
-void RMSRPSession::CancelReceiving( )
+TInt RMSRPSession::CancelReceiving( const TDesC8& aMessageId )
     {
     MSRPLOG("RMSRP Session.. CancelReceiving Entered");
-    SendReceive( EMSRPCancelReceiving );
-    MSRPLOG("RMSRP Session.. CancelReceiving Done ");
+    return SendReceive( EMSRPCancelReceiving, TIpcArgs( &aMessageId ) );
     }
     
 
@@ -207,20 +212,33 @@
     return iSendResultListenMSRPDataPckg().iTotalBytes;
     }
 
-
-TInt RMSRPSession::SendFileL(TDesC8& aFileParamBuffer)
+// -----------------------------------------------------------------------------
+// RMSRPSession::ListenMessageId
+// -----------------------------------------------------------------------------
+//
+TDesC8& RMSRPSession::ListenMessageId()
     {
-    /* Send File Params to the sub-session */
-    MSRPLOG("RMSRP Session.. SendFileParams");
-    iSendMSRPDataPckg().iExtMessageBuffer = aFileParamBuffer;
-    return SendReceive( EMSRPSendFile, TIpcArgs( &iSendMSRPDataPckg ) );
+    return iListenMSRPDataPckg().iMessageId;
     }
 
-TInt RMSRPSession::ReceiveFileL(TDesC8& aFileParamBuffer)
+// -----------------------------------------------------------------------------
+// RMSRPSession::SendMessageId
+// -----------------------------------------------------------------------------
+//
+TDesC8& RMSRPSession::SendMessageId()
     {
-    /* Send File Params to the sub-session */
-    MSRPLOG("RMSRP Session.. SendFileParams");
-    iSendMSRPDataPckg().iExtMessageBuffer = aFileParamBuffer;
-    return SendReceive( EMSRPReceiveFile, TIpcArgs( &iSendMSRPDataPckg ) );
+    return iSendResultListenMSRPDataPckg().iMessageId;
     }
+
+// -----------------------------------------------------------------------------
+// RMSRPSession::SendMessageId
+// -----------------------------------------------------------------------------
+//
+TInt  RMSRPSession::SetProgressReports( TBool aProgress )
+    {
+    return SendReceive( EMSRPProgressReports, TIpcArgs( aProgress ) );
+    }
+
 #endif /* RMSRPSESSION_CPP_ */
+
+// End of file
--- a/Msrp/MsrpHeader/bwins/msrpheaderu.def	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/bwins/msrpheaderu.def	Thu Nov 25 13:59:42 2010 +0200
@@ -1,96 +1,107 @@
 EXPORTS
-	?SetStatusCodeL@CMSRPResponse@@QAEXI@Z @ 1 NONAME ; void CMSRPResponse::SetStatusCodeL(unsigned int)
-	?DecodeL@CMSRPFromPathHeader@@SAPAV1@ABVTDesC8@@@Z @ 2 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::DecodeL(class TDesC8 const &)
-	?SetToPathHeader@CMSRPMessageBase@@QAEXPAVCMSRPToPathHeader@@@Z @ 3 NONAME ; void CMSRPMessageBase::SetToPathHeader(class CMSRPToPathHeader *)
-	?InternalizeValueL@CMSRPFromPathHeader@@SAPAV1@AAVRReadStream@@@Z @ 4 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::InternalizeValueL(class RReadStream &)
-	?InternalizeValueL@CMSRPFailureReportHeader@@SAPAV1@AAVRReadStream@@@Z @ 5 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::InternalizeValueL(class RReadStream &)
-	?Close@MSRPStrings@@SAXXZ @ 6 NONAME ; void MSRPStrings::Close(void)
-	?ReasonPhrase@CMSRPResponse@@QBE?AVRStringF@@XZ @ 7 NONAME ; class RStringF CMSRPResponse::ReasonPhrase(void) const
-	?OpenL@MSRPStrings@@SAXXZ @ 8 NONAME ; void MSRPStrings::OpenL(void)
-	?SetEndPosition@CMSRPByteRangeHeader@@QAEXH@Z @ 9 NONAME ; void CMSRPByteRangeHeader::SetEndPosition(int)
-	?NewLC@CMSRPByteRangeHeader@@SAPAV1@HHH@Z @ 10 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::NewLC(int, int, int)
-	?IsContent@CMSRPMessage@@QBEHXZ @ 11 NONAME ; int CMSRPMessage::IsContent(void) const
-	?InternalizeValueL@CMSRPSuccessReportHeader@@SAPAV1@AAVRReadStream@@@Z @ 12 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::InternalizeValueL(class RReadStream &)
-	?ToTextValueLC@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 13 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextValueLC(void) const
-	??1CMSRPMessageBase@@UAE@XZ @ 14 NONAME ; CMSRPMessageBase::~CMSRPMessageBase(void)
-	?NewL@CMSRPToPathHeader@@SAPAV1@PAVCUri8@@@Z @ 15 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::NewL(class CUri8 *)
-	?NewLC@CMSRPSuccessReportHeader@@SAPAV1@ABVRStringF@@@Z @ 16 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::NewLC(class RStringF const &)
-	?ExternalizeValueL@CMSRPFailureReportHeader@@QBEXAAVRWriteStream@@@Z @ 17 NONAME ; void CMSRPFailureReportHeader::ExternalizeValueL(class RWriteStream &) const
-	??0CMSRPResponse@@QAE@IVRStringF@@@Z @ 18 NONAME ; CMSRPResponse::CMSRPResponse(unsigned int, class RStringF)
-	??1CMSRPFromPathHeader@@UAE@XZ @ 19 NONAME ; CMSRPFromPathHeader::~CMSRPFromPathHeader(void)
-	?ExternalizeL@CMSRPMessage@@UAEXAAVRWriteStream@@@Z @ 20 NONAME ; void CMSRPMessage::ExternalizeL(class RWriteStream &)
-	??1CMSRPMessageIdHeader@@UAE@XZ @ 21 NONAME ; CMSRPMessageIdHeader::~CMSRPMessageIdHeader(void)
-	?SetSuccessReportHeader@CMSRPMessageBase@@QAEXPAVCMSRPSuccessReportHeader@@@Z @ 22 NONAME ; void CMSRPMessageBase::SetSuccessReportHeader(class CMSRPSuccessReportHeader *)
-	?InternalizeL@CMSRPMessage@@SAPAV1@AAVRReadStream@@@Z @ 23 NONAME ; class CMSRPMessage * CMSRPMessage::InternalizeL(class RReadStream &)
-	?NewLC@CMSRPToPathHeader@@SAPAV1@PAVCUri8@@@Z @ 24 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::NewLC(class CUri8 *)
-	?ToTextLC@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 25 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextLC(void) const
-	?InternalizeValueL@CMSRPToPathHeader@@SAPAV1@AAVRReadStream@@@Z @ 26 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::InternalizeValueL(class RReadStream &)
-	??1CMSRPFromToHeaderBase@@UAE@XZ @ 27 NONAME ; CMSRPFromToHeaderBase::~CMSRPFromToHeaderBase(void)
-	??8CMSRPFromToHeaderBase@@QBEHABV0@@Z @ 28 NONAME ; int CMSRPFromToHeaderBase::operator==(class CMSRPFromToHeaderBase const &) const
-	?SuccessReportHeader@CMSRPMessageBase@@QBEPBVCMSRPSuccessReportHeader@@XZ @ 29 NONAME ; class CMSRPSuccessReportHeader const * CMSRPMessageBase::SuccessReportHeader(void) const
-	?ExternalizeValueL@CMSRPContentTypeHeader@@QBEXAAVRWriteStream@@@Z @ 30 NONAME ; void CMSRPContentTypeHeader::ExternalizeValueL(class RWriteStream &) const
-	?InternalizeValueL@CMSRPMessageIdHeader@@SAPAV1@AAVRReadStream@@@Z @ 31 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::InternalizeValueL(class RReadStream &)
-	?TotalLength@CMSRPByteRangeHeader@@QBEHXZ @ 32 NONAME ; int CMSRPByteRangeHeader::TotalLength(void) const
-	?SetMessageIdHeader@CMSRPMessageBase@@QAEXPAVCMSRPMessageIdHeader@@@Z @ 33 NONAME ; void CMSRPMessageBase::SetMessageIdHeader(class CMSRPMessageIdHeader *)
-	?NewL@CMSRPFailureReportHeader@@SAPAV1@ABVRStringF@@@Z @ 34 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::NewL(class RStringF const &)
-	?FromPathHeader@CMSRPMessageBase@@QBEPBVCMSRPFromPathHeader@@XZ @ 35 NONAME ; class CMSRPFromPathHeader const * CMSRPMessageBase::FromPathHeader(void) const
-	?DecodeL@CMSRPToPathHeader@@SAPAV1@ABVTDesC8@@@Z @ 36 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::DecodeL(class TDesC8 const &)
-	?ToPathHeader@CMSRPMessageBase@@QBEPBVCMSRPToPathHeader@@XZ @ 37 NONAME ; class CMSRPToPathHeader const * CMSRPMessageBase::ToPathHeader(void) const
-	??0CMSRPResponse@@QAE@XZ @ 38 NONAME ; CMSRPResponse::CMSRPResponse(void)
-	?OpenL@MSRPStrings@@SAXAAVRStringPool@@@Z @ 39 NONAME ; void MSRPStrings::OpenL(class RStringPool &)
-	??1CMSRPContentTypeHeader@@UAE@XZ @ 40 NONAME ; CMSRPContentTypeHeader::~CMSRPContentTypeHeader(void)
-	?NewL@CMSRPFromPathHeader@@SAPAV1@PAVCUri8@@@Z @ 41 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::NewL(class CUri8 *)
-	?FailureReportHeader@CMSRPMessageBase@@QBEPBVCMSRPFailureReportHeader@@XZ @ 42 NONAME ; class CMSRPFailureReportHeader const * CMSRPMessageBase::FailureReportHeader(void) const
-	??1CMSRPHeaderBase@@UAE@XZ @ 43 NONAME ; CMSRPHeaderBase::~CMSRPHeaderBase(void)
-	?ExternalizeValueL@CMSRPMessageIdHeader@@QBEXAAVRWriteStream@@@Z @ 44 NONAME ; void CMSRPMessageIdHeader::ExternalizeValueL(class RWriteStream &) const
-	?NewLC@CMSRPMessageIdHeader@@SAPAV1@ABVTDesC8@@@Z @ 45 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::NewLC(class TDesC8 const &)
-	??1CMSRPResponse@@UAE@XZ @ 46 NONAME ; CMSRPResponse::~CMSRPResponse(void)
-	?NewL@CMSRPByteRangeHeader@@SAPAV1@HHH@Z @ 47 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::NewL(int, int, int)
-	?NewL@CMSRPSuccessReportHeader@@SAPAV1@ABVRStringF@@@Z @ 48 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::NewL(class RStringF const &)
-	??1CMSRPFailureReportHeader@@UAE@XZ @ 49 NONAME ; CMSRPFailureReportHeader::~CMSRPFailureReportHeader(void)
-	?Pool@MSRPStrings@@SA?AVRStringPool@@XZ @ 50 NONAME ; class RStringPool MSRPStrings::Pool(void)
-	?SetTotalLength@CMSRPByteRangeHeader@@QAEXH@Z @ 51 NONAME ; void CMSRPByteRangeHeader::SetTotalLength(int)
-	??1CMSRPSuccessReportHeader@@UAE@XZ @ 52 NONAME ; CMSRPSuccessReportHeader::~CMSRPSuccessReportHeader(void)
-	?NewL@CMSRPContentTypeHeader@@SAPAV1@ABVTDesC8@@@Z @ 53 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::NewL(class TDesC8 const &)
-	?NewLC@CMSRPContentTypeHeader@@SAPAV1@ABVTDesC8@@@Z @ 54 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::NewLC(class TDesC8 const &)
-	??1CMSRPMessage@@UAE@XZ @ 55 NONAME ; CMSRPMessage::~CMSRPMessage(void)
-	?InternalizeL@CMSRPResponse@@SAPAV1@AAVRReadStream@@@Z @ 56 NONAME ; class CMSRPResponse * CMSRPResponse::InternalizeL(class RReadStream &)
-	?Content@CMSRPMessage@@QAEABVTDesC8@@XZ @ 57 NONAME ; class TDesC8 const & CMSRPMessage::Content(void)
-	??1CMSRPToPathHeader@@UAE@XZ @ 58 NONAME ; CMSRPToPathHeader::~CMSRPToPathHeader(void)
-	?SetContent@CMSRPMessage@@QAEXPAVHBufC8@@@Z @ 59 NONAME ; void CMSRPMessage::SetContent(class HBufC8 *)
-	?Table@MSRPStrings@@SAABUTStringTable@@XZ @ 60 NONAME ; struct TStringTable const & MSRPStrings::Table(void)
-	?StatusCode@CMSRPResponse@@QBEIXZ @ 61 NONAME ; unsigned int CMSRPResponse::StatusCode(void) const
-	?ContentTypeHeader@CMSRPMessageBase@@QBEPBVCMSRPContentTypeHeader@@XZ @ 62 NONAME ; class CMSRPContentTypeHeader const * CMSRPMessageBase::ContentTypeHeader(void) const
-	?SetContentTypeHeader@CMSRPMessageBase@@QAEXPAVCMSRPContentTypeHeader@@@Z @ 63 NONAME ; void CMSRPMessageBase::SetContentTypeHeader(class CMSRPContentTypeHeader *)
-	?ExternalizeValueL@CMSRPSuccessReportHeader@@QBEXAAVRWriteStream@@@Z @ 64 NONAME ; void CMSRPSuccessReportHeader::ExternalizeValueL(class RWriteStream &) const
-	?InternalizeValueL@CMSRPByteRangeHeader@@SAPAV1@AAVRReadStream@@@Z @ 65 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::InternalizeValueL(class RReadStream &)
-	?IsResponse@CMSRPResponse@@SAHABVTDesC8@@@Z @ 66 NONAME ; int CMSRPResponse::IsResponse(class TDesC8 const &)
-	?EndPosition@CMSRPByteRangeHeader@@QBEHXZ @ 67 NONAME ; int CMSRPByteRangeHeader::EndPosition(void) const
-	?ToTextL@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 68 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextL(void) const
-	??0CMSRPMessage@@QAE@XZ @ 69 NONAME ; CMSRPMessage::CMSRPMessage(void)
-	?StringF@MSRPStrings@@SA?AVRStringF@@H@Z @ 70 NONAME ; class RStringF MSRPStrings::StringF(int)
-	?SetFailureReportHeader@CMSRPMessageBase@@QAEXPAVCMSRPFailureReportHeader@@@Z @ 71 NONAME ; void CMSRPMessageBase::SetFailureReportHeader(class CMSRPFailureReportHeader *)
-	?NewL@CMSRPMessageIdHeader@@SAPAV1@ABVTDesC8@@@Z @ 72 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::NewL(class TDesC8 const &)
-	?IsMessage@CMSRPMessage@@SAHABVTDesC8@@@Z @ 73 NONAME ; int CMSRPMessage::IsMessage(class TDesC8 const &)
-	?SetStartPosition@CMSRPByteRangeHeader@@QAEXH@Z @ 74 NONAME ; void CMSRPByteRangeHeader::SetStartPosition(int)
-	?SetFromPathHeader@CMSRPMessageBase@@QAEXPAVCMSRPFromPathHeader@@@Z @ 75 NONAME ; void CMSRPMessageBase::SetFromPathHeader(class CMSRPFromPathHeader *)
-	?ByteRangeHeader@CMSRPMessageBase@@QBEPBVCMSRPByteRangeHeader@@XZ @ 76 NONAME ; class CMSRPByteRangeHeader const * CMSRPMessageBase::ByteRangeHeader(void) const
-	?ExternalizeValueL@CMSRPFromToHeaderBase@@QBEXAAVRWriteStream@@@Z @ 77 NONAME ; void CMSRPFromToHeaderBase::ExternalizeValueL(class RWriteStream &) const
-	??1CMSRPByteRangeHeader@@UAE@XZ @ 78 NONAME ; CMSRPByteRangeHeader::~CMSRPByteRangeHeader(void)
-	?NewLC@CMSRPFromPathHeader@@SAPAV1@PAVCUri8@@@Z @ 79 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::NewLC(class CUri8 *)
-	?InternalizeValueL@CMSRPContentTypeHeader@@SAPAV1@AAVRReadStream@@@Z @ 80 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::InternalizeValueL(class RReadStream &)
-	?MessageIdHeader@CMSRPMessageBase@@QBEPBVCMSRPMessageIdHeader@@XZ @ 81 NONAME ; class CMSRPMessageIdHeader const * CMSRPMessageBase::MessageIdHeader(void) const
-	?StartPosition@CMSRPByteRangeHeader@@QBEHXZ @ 82 NONAME ; int CMSRPByteRangeHeader::StartPosition(void) const
-	?SetByteRangeHeader@CMSRPMessageBase@@QAEXPAVCMSRPByteRangeHeader@@@Z @ 83 NONAME ; void CMSRPMessageBase::SetByteRangeHeader(class CMSRPByteRangeHeader *)
-	?SetReasonPhrase@CMSRPResponse@@QAEXVRStringF@@@Z @ 84 NONAME ; void CMSRPResponse::SetReasonPhrase(class RStringF)
-	?ExternalizeValueL@CMSRPByteRangeHeader@@QBEXAAVRWriteStream@@@Z @ 85 NONAME ; void CMSRPByteRangeHeader::ExternalizeValueL(class RWriteStream &) const
-	?NewLC@CMSRPFailureReportHeader@@SAPAV1@ABVRStringF@@@Z @ 86 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::NewLC(class RStringF const &)
-	?ExternalizeL@CMSRPResponse@@UAEXAAVRWriteStream@@@Z @ 87 NONAME ; void CMSRPResponse::ExternalizeL(class RWriteStream &)
-	?GetNotifyProgress@CMSRPMessage@@QAEHXZ @ 88 NONAME ; int CMSRPMessage::GetNotifyProgress(void)
-	?SetNotifyProgress@CMSRPMessage@@QAEXH@Z @ 89 NONAME ; void CMSRPMessage::SetNotifyProgress(int)
-	?SetFileName@CMSRPMessage@@QAEXABV?$TBuf@$0BAA@@@@Z @ 90 NONAME ; void CMSRPMessage::SetFileName(class TBuf<256> const &)
-	?GetFileName@CMSRPMessage@@QAEAAV?$TBuf@$0BAA@@@XZ @ 91 NONAME ; class TBuf<256> & CMSRPMessage::GetFileName(void)
-	?IsFile@CMSRPMessage@@QAEHXZ @ 92 NONAME ; int CMSRPMessage::IsFile(void)
-	?SetFileSize@CMSRPMessage@@QAEXH@Z @ 93 NONAME ; void CMSRPMessage::SetFileSize(int)
-	?GetFileSize@CMSRPMessage@@QAEHXZ @ 94 NONAME ; int CMSRPMessage::GetFileSize(void)
+	??0CMSRPMessage@@QAE@XZ @ 1 NONAME ; CMSRPMessage::CMSRPMessage(void)
+	??0CMSRPReport@@QAE@XZ @ 2 NONAME ; CMSRPReport::CMSRPReport(void)
+	??0CMSRPResponse@@QAE@IVRStringF@@@Z @ 3 NONAME ; CMSRPResponse::CMSRPResponse(unsigned int, class RStringF)
+	??0CMSRPResponse@@QAE@XZ @ 4 NONAME ; CMSRPResponse::CMSRPResponse(void)
+	??1CMSRPByteRangeHeader@@UAE@XZ @ 5 NONAME ; CMSRPByteRangeHeader::~CMSRPByteRangeHeader(void)
+	??1CMSRPContentTypeHeader@@UAE@XZ @ 6 NONAME ; CMSRPContentTypeHeader::~CMSRPContentTypeHeader(void)
+	??1CMSRPFailureReportHeader@@UAE@XZ @ 7 NONAME ; CMSRPFailureReportHeader::~CMSRPFailureReportHeader(void)
+	??1CMSRPFromPathHeader@@UAE@XZ @ 8 NONAME ; CMSRPFromPathHeader::~CMSRPFromPathHeader(void)
+	??1CMSRPFromToHeaderBase@@UAE@XZ @ 9 NONAME ; CMSRPFromToHeaderBase::~CMSRPFromToHeaderBase(void)
+	??1CMSRPHeaderBase@@UAE@XZ @ 10 NONAME ; CMSRPHeaderBase::~CMSRPHeaderBase(void)
+	??1CMSRPMessage@@UAE@XZ @ 11 NONAME ; CMSRPMessage::~CMSRPMessage(void)
+	??1CMSRPMessageBase@@UAE@XZ @ 12 NONAME ; CMSRPMessageBase::~CMSRPMessageBase(void)
+	??1CMSRPMessageIdHeader@@UAE@XZ @ 13 NONAME ; CMSRPMessageIdHeader::~CMSRPMessageIdHeader(void)
+	??1CMSRPReport@@UAE@XZ @ 14 NONAME ; CMSRPReport::~CMSRPReport(void)
+	??1CMSRPResponse@@UAE@XZ @ 15 NONAME ; CMSRPResponse::~CMSRPResponse(void)
+	??1CMSRPStatusHeader@@UAE@XZ @ 16 NONAME ; CMSRPStatusHeader::~CMSRPStatusHeader(void)
+	??1CMSRPSuccessReportHeader@@UAE@XZ @ 17 NONAME ; CMSRPSuccessReportHeader::~CMSRPSuccessReportHeader(void)
+	??1CMSRPToPathHeader@@UAE@XZ @ 18 NONAME ; CMSRPToPathHeader::~CMSRPToPathHeader(void)
+	??8CMSRPFromToHeaderBase@@QBEHABV0@@Z @ 19 NONAME ; int CMSRPFromToHeaderBase::operator==(class CMSRPFromToHeaderBase const &) const
+	?ByteRangeHeader@CMSRPMessageBase@@QBEPBVCMSRPByteRangeHeader@@XZ @ 20 NONAME ; class CMSRPByteRangeHeader const * CMSRPMessageBase::ByteRangeHeader(void) const
+	?Close@MSRPStrings@@SAXXZ @ 21 NONAME ; void MSRPStrings::Close(void)
+	?Content@CMSRPMessage@@QAEABVTDesC8@@XZ @ 22 NONAME ; class TDesC8 const & CMSRPMessage::Content(void)
+	?ContentTypeHeader@CMSRPMessageBase@@QBEPBVCMSRPContentTypeHeader@@XZ @ 23 NONAME ; class CMSRPContentTypeHeader const * CMSRPMessageBase::ContentTypeHeader(void) const
+	?DecodeL@CMSRPFromPathHeader@@SAPAV1@ABVTDesC8@@@Z @ 24 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::DecodeL(class TDesC8 const &)
+	?DecodeL@CMSRPToPathHeader@@SAPAV1@ABVTDesC8@@@Z @ 25 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::DecodeL(class TDesC8 const &)
+	?EndPosition@CMSRPByteRangeHeader@@QBEHXZ @ 26 NONAME ; int CMSRPByteRangeHeader::EndPosition(void) const
+	?ExternalizeL@CMSRPMessage@@UAEXAAVRWriteStream@@@Z @ 27 NONAME ; void CMSRPMessage::ExternalizeL(class RWriteStream &)
+	?ExternalizeL@CMSRPReport@@UAEXAAVRWriteStream@@@Z @ 28 NONAME ; void CMSRPReport::ExternalizeL(class RWriteStream &)
+	?ExternalizeL@CMSRPResponse@@UAEXAAVRWriteStream@@@Z @ 29 NONAME ; void CMSRPResponse::ExternalizeL(class RWriteStream &)
+	?ExternalizeValueL@CMSRPByteRangeHeader@@QBEXAAVRWriteStream@@@Z @ 30 NONAME ; void CMSRPByteRangeHeader::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPContentTypeHeader@@QBEXAAVRWriteStream@@@Z @ 31 NONAME ; void CMSRPContentTypeHeader::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPFailureReportHeader@@QBEXAAVRWriteStream@@@Z @ 32 NONAME ; void CMSRPFailureReportHeader::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPFromToHeaderBase@@QBEXAAVRWriteStream@@@Z @ 33 NONAME ; void CMSRPFromToHeaderBase::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPMessageIdHeader@@QBEXAAVRWriteStream@@@Z @ 34 NONAME ; void CMSRPMessageIdHeader::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPStatusHeader@@QBEXAAVRWriteStream@@@Z @ 35 NONAME ; void CMSRPStatusHeader::ExternalizeValueL(class RWriteStream &) const
+	?ExternalizeValueL@CMSRPSuccessReportHeader@@QBEXAAVRWriteStream@@@Z @ 36 NONAME ; void CMSRPSuccessReportHeader::ExternalizeValueL(class RWriteStream &) const
+	?FailureReportHeader@CMSRPMessageBase@@QBEPBVCMSRPFailureReportHeader@@XZ @ 37 NONAME ; class CMSRPFailureReportHeader const * CMSRPMessageBase::FailureReportHeader(void) const
+	?FromPathHeader@CMSRPMessageBase@@QBEPBVCMSRPFromPathHeader@@XZ @ 38 NONAME ; class CMSRPFromPathHeader const * CMSRPMessageBase::FromPathHeader(void) const
+	?GetFileName@CMSRPMessage@@QAEAAV?$TBuf@$0BAA@@@XZ @ 39 NONAME ; class TBuf<256> & CMSRPMessage::GetFileName(void)
+	?InternalizeL@CMSRPMessage@@SAPAV1@AAVRReadStream@@@Z @ 40 NONAME ; class CMSRPMessage * CMSRPMessage::InternalizeL(class RReadStream &)
+	?InternalizeL@CMSRPReport@@SAPAV1@AAVRReadStream@@@Z @ 41 NONAME ; class CMSRPReport * CMSRPReport::InternalizeL(class RReadStream &)
+	?InternalizeL@CMSRPResponse@@SAPAV1@AAVRReadStream@@@Z @ 42 NONAME ; class CMSRPResponse * CMSRPResponse::InternalizeL(class RReadStream &)
+	?InternalizeValueL@CMSRPByteRangeHeader@@SAPAV1@AAVRReadStream@@@Z @ 43 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPContentTypeHeader@@SAPAV1@AAVRReadStream@@@Z @ 44 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPFailureReportHeader@@SAPAV1@AAVRReadStream@@@Z @ 45 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPFromPathHeader@@SAPAV1@AAVRReadStream@@@Z @ 46 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPMessageIdHeader@@SAPAV1@AAVRReadStream@@@Z @ 47 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPStatusHeader@@SAPAV1@AAVRReadStream@@@Z @ 48 NONAME ; class CMSRPStatusHeader * CMSRPStatusHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPSuccessReportHeader@@SAPAV1@AAVRReadStream@@@Z @ 49 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::InternalizeValueL(class RReadStream &)
+	?InternalizeValueL@CMSRPToPathHeader@@SAPAV1@AAVRReadStream@@@Z @ 50 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::InternalizeValueL(class RReadStream &)
+	?IsContent@CMSRPMessage@@QBEHXZ @ 51 NONAME ; int CMSRPMessage::IsContent(void) const
+	?IsFile@CMSRPMessage@@QAEHXZ @ 52 NONAME ; int CMSRPMessage::IsFile(void)
+	?IsMessage@CMSRPMessage@@SAHABVTDesC8@@@Z @ 53 NONAME ; int CMSRPMessage::IsMessage(class TDesC8 const &)
+	?IsReport@CMSRPReport@@SAHABVTDesC8@@@Z @ 54 NONAME ; int CMSRPReport::IsReport(class TDesC8 const &)
+	?IsResponse@CMSRPResponse@@SAHABVTDesC8@@@Z @ 55 NONAME ; int CMSRPResponse::IsResponse(class TDesC8 const &)
+	?MessageIdHeader@CMSRPMessageBase@@QBEPBVCMSRPMessageIdHeader@@XZ @ 56 NONAME ; class CMSRPMessageIdHeader const * CMSRPMessageBase::MessageIdHeader(void) const
+	?NewL@CMSRPByteRangeHeader@@SAPAV1@HHH@Z @ 57 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::NewL(int, int, int)
+	?NewL@CMSRPContentTypeHeader@@SAPAV1@ABVTDesC8@@@Z @ 58 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::NewL(class TDesC8 const &)
+	?NewL@CMSRPFailureReportHeader@@SAPAV1@ABVRStringF@@@Z @ 59 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::NewL(class RStringF const &)
+	?NewL@CMSRPFromPathHeader@@SAPAV1@PAVCUri8@@@Z @ 60 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::NewL(class CUri8 *)
+	?NewL@CMSRPMessageIdHeader@@SAPAV1@ABVTDesC8@@@Z @ 61 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::NewL(class TDesC8 const &)
+	?NewL@CMSRPStatusHeader@@SAPAV1@H@Z @ 62 NONAME ; class CMSRPStatusHeader * CMSRPStatusHeader::NewL(int)
+	?NewL@CMSRPSuccessReportHeader@@SAPAV1@ABVRStringF@@@Z @ 63 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::NewL(class RStringF const &)
+	?NewL@CMSRPToPathHeader@@SAPAV1@PAVCUri8@@@Z @ 64 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::NewL(class CUri8 *)
+	?NewLC@CMSRPByteRangeHeader@@SAPAV1@HHH@Z @ 65 NONAME ; class CMSRPByteRangeHeader * CMSRPByteRangeHeader::NewLC(int, int, int)
+	?NewLC@CMSRPContentTypeHeader@@SAPAV1@ABVTDesC8@@@Z @ 66 NONAME ; class CMSRPContentTypeHeader * CMSRPContentTypeHeader::NewLC(class TDesC8 const &)
+	?NewLC@CMSRPFailureReportHeader@@SAPAV1@ABVRStringF@@@Z @ 67 NONAME ; class CMSRPFailureReportHeader * CMSRPFailureReportHeader::NewLC(class RStringF const &)
+	?NewLC@CMSRPFromPathHeader@@SAPAV1@PAVCUri8@@@Z @ 68 NONAME ; class CMSRPFromPathHeader * CMSRPFromPathHeader::NewLC(class CUri8 *)
+	?NewLC@CMSRPMessageIdHeader@@SAPAV1@ABVTDesC8@@@Z @ 69 NONAME ; class CMSRPMessageIdHeader * CMSRPMessageIdHeader::NewLC(class TDesC8 const &)
+	?NewLC@CMSRPStatusHeader@@SAPAV1@H@Z @ 70 NONAME ; class CMSRPStatusHeader * CMSRPStatusHeader::NewLC(int)
+	?NewLC@CMSRPSuccessReportHeader@@SAPAV1@ABVRStringF@@@Z @ 71 NONAME ; class CMSRPSuccessReportHeader * CMSRPSuccessReportHeader::NewLC(class RStringF const &)
+	?NewLC@CMSRPToPathHeader@@SAPAV1@PAVCUri8@@@Z @ 72 NONAME ; class CMSRPToPathHeader * CMSRPToPathHeader::NewLC(class CUri8 *)
+	?OpenL@MSRPStrings@@SAXAAVRStringPool@@@Z @ 73 NONAME ; void MSRPStrings::OpenL(class RStringPool &)
+	?OpenL@MSRPStrings@@SAXXZ @ 74 NONAME ; void MSRPStrings::OpenL(void)
+	?Pool@MSRPStrings@@SA?AVRStringPool@@XZ @ 75 NONAME ; class RStringPool MSRPStrings::Pool(void)
+	?ReasonPhrase@CMSRPResponse@@QBE?AVRStringF@@XZ @ 76 NONAME ; class RStringF CMSRPResponse::ReasonPhrase(void) const
+	?SetByteRangeHeader@CMSRPMessageBase@@QAEXPAVCMSRPByteRangeHeader@@@Z @ 77 NONAME ; void CMSRPMessageBase::SetByteRangeHeader(class CMSRPByteRangeHeader *)
+	?SetContent@CMSRPMessage@@QAEXPAVHBufC8@@@Z @ 78 NONAME ; void CMSRPMessage::SetContent(class HBufC8 *)
+	?SetContentTypeHeader@CMSRPMessageBase@@QAEXPAVCMSRPContentTypeHeader@@@Z @ 79 NONAME ; void CMSRPMessageBase::SetContentTypeHeader(class CMSRPContentTypeHeader *)
+	?SetEndPosition@CMSRPByteRangeHeader@@QAEXH@Z @ 80 NONAME ; void CMSRPByteRangeHeader::SetEndPosition(int)
+	?SetFailureReportHeader@CMSRPMessageBase@@QAEXPAVCMSRPFailureReportHeader@@@Z @ 81 NONAME ; void CMSRPMessageBase::SetFailureReportHeader(class CMSRPFailureReportHeader *)
+	?SetFileName@CMSRPMessage@@QAEXABV?$TBuf@$0BAA@@@@Z @ 82 NONAME ; void CMSRPMessage::SetFileName(class TBuf<256> const &)
+	?SetFromPathHeader@CMSRPMessageBase@@QAEXPAVCMSRPFromPathHeader@@@Z @ 83 NONAME ; void CMSRPMessageBase::SetFromPathHeader(class CMSRPFromPathHeader *)
+	?SetMessageIdHeader@CMSRPMessageBase@@QAEXPAVCMSRPMessageIdHeader@@@Z @ 84 NONAME ; void CMSRPMessageBase::SetMessageIdHeader(class CMSRPMessageIdHeader *)
+	?SetReasonPhrase@CMSRPResponse@@QAEXVRStringF@@@Z @ 85 NONAME ; void CMSRPResponse::SetReasonPhrase(class RStringF)
+	?SetStartPosition@CMSRPByteRangeHeader@@QAEXH@Z @ 86 NONAME ; void CMSRPByteRangeHeader::SetStartPosition(int)
+	?SetStatusCode@CMSRPStatusHeader@@QAEXH@Z @ 87 NONAME ; void CMSRPStatusHeader::SetStatusCode(int)
+	?SetStatusCodeL@CMSRPResponse@@QAEXI@Z @ 88 NONAME ; void CMSRPResponse::SetStatusCodeL(unsigned int)
+	?SetStatusHeader@CMSRPMessageBase@@QAEXPAVCMSRPStatusHeader@@@Z @ 89 NONAME ; void CMSRPMessageBase::SetStatusHeader(class CMSRPStatusHeader *)
+	?SetSuccessReportHeader@CMSRPMessageBase@@QAEXPAVCMSRPSuccessReportHeader@@@Z @ 90 NONAME ; void CMSRPMessageBase::SetSuccessReportHeader(class CMSRPSuccessReportHeader *)
+	?SetToPathHeader@CMSRPMessageBase@@QAEXPAVCMSRPToPathHeader@@@Z @ 91 NONAME ; void CMSRPMessageBase::SetToPathHeader(class CMSRPToPathHeader *)
+	?SetTotalLength@CMSRPByteRangeHeader@@QAEXH@Z @ 92 NONAME ; void CMSRPByteRangeHeader::SetTotalLength(int)
+	?StartPosition@CMSRPByteRangeHeader@@QBEHXZ @ 93 NONAME ; int CMSRPByteRangeHeader::StartPosition(void) const
+	?StatusCode@CMSRPResponse@@QBEIXZ @ 94 NONAME ; unsigned int CMSRPResponse::StatusCode(void) const
+	?StatusCode@CMSRPStatusHeader@@QBEHXZ @ 95 NONAME ; int CMSRPStatusHeader::StatusCode(void) const
+	?StatusHeader@CMSRPMessageBase@@QBEPBVCMSRPStatusHeader@@XZ @ 96 NONAME ; class CMSRPStatusHeader const * CMSRPMessageBase::StatusHeader(void) const
+	?StringF@MSRPStrings@@SA?AVRStringF@@H@Z @ 97 NONAME ; class RStringF MSRPStrings::StringF(int)
+	?SuccessReportHeader@CMSRPMessageBase@@QBEPBVCMSRPSuccessReportHeader@@XZ @ 98 NONAME ; class CMSRPSuccessReportHeader const * CMSRPMessageBase::SuccessReportHeader(void) const
+	?Table@MSRPStrings@@SAABUTStringTable@@XZ @ 99 NONAME ; struct TStringTable const & MSRPStrings::Table(void)
+	?ToPathHeader@CMSRPMessageBase@@QBEPBVCMSRPToPathHeader@@XZ @ 100 NONAME ; class CMSRPToPathHeader const * CMSRPMessageBase::ToPathHeader(void) const
+	?ToTextL@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 101 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextL(void) const
+	?ToTextLC@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 102 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextLC(void) const
+	?ToTextValueLC@CMSRPHeaderBase@@QBEPAVHBufC8@@XZ @ 103 NONAME ; class HBufC8 * CMSRPHeaderBase::ToTextValueLC(void) const
+	?TotalLength@CMSRPByteRangeHeader@@QBEHXZ @ 104 NONAME ; int CMSRPByteRangeHeader::TotalLength(void) const
+	?__DbgTestInvariant@CMSRPStatusHeader@@QBEXXZ @ 105 NONAME ; void CMSRPStatusHeader::__DbgTestInvariant(void) const
 
--- a/Msrp/MsrpHeader/eabi/msrpheaderu.def	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/eabi/msrpheaderu.def	Thu Nov 25 13:59:42 2010 +0200
@@ -1,148 +1,166 @@
 EXPORTS
-	_ZN11MSRPStrings4PoolEv @ 1 NONAME
-	_ZN11MSRPStrings5CloseEv @ 2 NONAME
-	_ZN11MSRPStrings5OpenLER11RStringPool @ 3 NONAME
-	_ZN11MSRPStrings5OpenLEv @ 4 NONAME
-	_ZN11MSRPStrings5TableEv @ 5 NONAME
-	_ZN11MSRPStrings7StringFEi @ 6 NONAME
-	_ZN12CMSRPMessage10SetContentEP6HBufC8 @ 7 NONAME
-	_ZN12CMSRPMessage11GetFileNameEv @ 8 NONAME
-	_ZN12CMSRPMessage11GetFileSizeEv @ 9 NONAME
-	_ZN12CMSRPMessage11SetFileNameERK4TBufILi256EE @ 10 NONAME
-	_ZN12CMSRPMessage11SetFileSizeEi @ 11 NONAME
-	_ZN12CMSRPMessage12ExternalizeLER12RWriteStream @ 12 NONAME
-	_ZN12CMSRPMessage12InternalizeLER11RReadStream @ 13 NONAME
-	_ZN12CMSRPMessage17GetNotifyProgressEv @ 14 NONAME
-	_ZN12CMSRPMessage17SetNotifyProgressEi @ 15 NONAME
-	_ZN12CMSRPMessage6IsFileEv @ 16 NONAME
-	_ZN12CMSRPMessage7ContentEv @ 17 NONAME
-	_ZN12CMSRPMessage9IsMessageERK6TDesC8 @ 18 NONAME
-	_ZN12CMSRPMessageC1Ev @ 19 NONAME
-	_ZN12CMSRPMessageC2Ev @ 20 NONAME
-	_ZN12CMSRPMessageD0Ev @ 21 NONAME
-	_ZN12CMSRPMessageD1Ev @ 22 NONAME
-	_ZN12CMSRPMessageD2Ev @ 23 NONAME
-	_ZN13CMSRPResponse10IsResponseERK6TDesC8 @ 24 NONAME
-	_ZN13CMSRPResponse12ExternalizeLER12RWriteStream @ 25 NONAME
-	_ZN13CMSRPResponse12InternalizeLER11RReadStream @ 26 NONAME
-	_ZN13CMSRPResponse14SetStatusCodeLEj @ 27 NONAME
-	_ZN13CMSRPResponse15SetReasonPhraseE8RStringF @ 28 NONAME
-	_ZN13CMSRPResponseC1Ej8RStringF @ 29 NONAME
-	_ZN13CMSRPResponseC1Ev @ 30 NONAME
-	_ZN13CMSRPResponseC2Ej8RStringF @ 31 NONAME
-	_ZN13CMSRPResponseC2Ev @ 32 NONAME
-	_ZN13CMSRPResponseD0Ev @ 33 NONAME
-	_ZN13CMSRPResponseD1Ev @ 34 NONAME
-	_ZN13CMSRPResponseD2Ev @ 35 NONAME
-	_ZN15CMSRPHeaderBaseD0Ev @ 36 NONAME
-	_ZN15CMSRPHeaderBaseD1Ev @ 37 NONAME
-	_ZN15CMSRPHeaderBaseD2Ev @ 38 NONAME
-	_ZN16CMSRPMessageBase15SetToPathHeaderEP17CMSRPToPathHeader @ 39 NONAME
-	_ZN16CMSRPMessageBase17SetFromPathHeaderEP19CMSRPFromPathHeader @ 40 NONAME
-	_ZN16CMSRPMessageBase18SetByteRangeHeaderEP20CMSRPByteRangeHeader @ 41 NONAME
-	_ZN16CMSRPMessageBase18SetMessageIdHeaderEP20CMSRPMessageIdHeader @ 42 NONAME
-	_ZN16CMSRPMessageBase20SetContentTypeHeaderEP22CMSRPContentTypeHeader @ 43 NONAME
-	_ZN16CMSRPMessageBase22SetFailureReportHeaderEP24CMSRPFailureReportHeader @ 44 NONAME
-	_ZN16CMSRPMessageBase22SetSuccessReportHeaderEP24CMSRPSuccessReportHeader @ 45 NONAME
-	_ZN16CMSRPMessageBaseD0Ev @ 46 NONAME
-	_ZN16CMSRPMessageBaseD1Ev @ 47 NONAME
-	_ZN16CMSRPMessageBaseD2Ev @ 48 NONAME
-	_ZN17CMSRPToPathHeader17InternalizeValueLER11RReadStream @ 49 NONAME
-	_ZN17CMSRPToPathHeader4NewLEP5CUri8 @ 50 NONAME
-	_ZN17CMSRPToPathHeader5NewLCEP5CUri8 @ 51 NONAME
-	_ZN17CMSRPToPathHeader7DecodeLERK6TDesC8 @ 52 NONAME
-	_ZN17CMSRPToPathHeaderD0Ev @ 53 NONAME
-	_ZN17CMSRPToPathHeaderD1Ev @ 54 NONAME
-	_ZN17CMSRPToPathHeaderD2Ev @ 55 NONAME
-	_ZN19CMSRPFromPathHeader17InternalizeValueLER11RReadStream @ 56 NONAME
-	_ZN19CMSRPFromPathHeader4NewLEP5CUri8 @ 57 NONAME
-	_ZN19CMSRPFromPathHeader5NewLCEP5CUri8 @ 58 NONAME
-	_ZN19CMSRPFromPathHeader7DecodeLERK6TDesC8 @ 59 NONAME
-	_ZN19CMSRPFromPathHeaderD0Ev @ 60 NONAME
-	_ZN19CMSRPFromPathHeaderD1Ev @ 61 NONAME
-	_ZN19CMSRPFromPathHeaderD2Ev @ 62 NONAME
-	_ZN20CMSRPByteRangeHeader14SetEndPositionEi @ 63 NONAME
-	_ZN20CMSRPByteRangeHeader14SetTotalLengthEi @ 64 NONAME
-	_ZN20CMSRPByteRangeHeader16SetStartPositionEi @ 65 NONAME
-	_ZN20CMSRPByteRangeHeader17InternalizeValueLER11RReadStream @ 66 NONAME
-	_ZN20CMSRPByteRangeHeader4NewLEiii @ 67 NONAME
-	_ZN20CMSRPByteRangeHeader5NewLCEiii @ 68 NONAME
-	_ZN20CMSRPByteRangeHeaderD0Ev @ 69 NONAME
-	_ZN20CMSRPByteRangeHeaderD1Ev @ 70 NONAME
-	_ZN20CMSRPByteRangeHeaderD2Ev @ 71 NONAME
-	_ZN20CMSRPMessageIdHeader17InternalizeValueLER11RReadStream @ 72 NONAME
-	_ZN20CMSRPMessageIdHeader4NewLERK6TDesC8 @ 73 NONAME
-	_ZN20CMSRPMessageIdHeader5NewLCERK6TDesC8 @ 74 NONAME
-	_ZN20CMSRPMessageIdHeaderD0Ev @ 75 NONAME
-	_ZN20CMSRPMessageIdHeaderD1Ev @ 76 NONAME
-	_ZN20CMSRPMessageIdHeaderD2Ev @ 77 NONAME
-	_ZN21CMSRPFromToHeaderBaseD0Ev @ 78 NONAME
-	_ZN21CMSRPFromToHeaderBaseD1Ev @ 79 NONAME
-	_ZN21CMSRPFromToHeaderBaseD2Ev @ 80 NONAME
-	_ZN22CMSRPContentTypeHeader17InternalizeValueLER11RReadStream @ 81 NONAME
-	_ZN22CMSRPContentTypeHeader4NewLERK6TDesC8 @ 82 NONAME
-	_ZN22CMSRPContentTypeHeader5NewLCERK6TDesC8 @ 83 NONAME
-	_ZN22CMSRPContentTypeHeaderD0Ev @ 84 NONAME
-	_ZN22CMSRPContentTypeHeaderD1Ev @ 85 NONAME
-	_ZN22CMSRPContentTypeHeaderD2Ev @ 86 NONAME
-	_ZN24CMSRPFailureReportHeader17InternalizeValueLER11RReadStream @ 87 NONAME
-	_ZN24CMSRPFailureReportHeader4NewLERK8RStringF @ 88 NONAME
-	_ZN24CMSRPFailureReportHeader5NewLCERK8RStringF @ 89 NONAME
-	_ZN24CMSRPFailureReportHeaderD0Ev @ 90 NONAME
-	_ZN24CMSRPFailureReportHeaderD1Ev @ 91 NONAME
-	_ZN24CMSRPFailureReportHeaderD2Ev @ 92 NONAME
-	_ZN24CMSRPSuccessReportHeader17InternalizeValueLER11RReadStream @ 93 NONAME
-	_ZN24CMSRPSuccessReportHeader4NewLERK8RStringF @ 94 NONAME
-	_ZN24CMSRPSuccessReportHeader5NewLCERK8RStringF @ 95 NONAME
-	_ZN24CMSRPSuccessReportHeaderD0Ev @ 96 NONAME
-	_ZN24CMSRPSuccessReportHeaderD1Ev @ 97 NONAME
-	_ZN24CMSRPSuccessReportHeaderD2Ev @ 98 NONAME
-	_ZNK12CMSRPMessage9IsContentEv @ 99 NONAME
-	_ZNK13CMSRPResponse10StatusCodeEv @ 100 NONAME
-	_ZNK13CMSRPResponse12ReasonPhraseEv @ 101 NONAME
-	_ZNK15CMSRPHeaderBase13ToTextValueLCEv @ 102 NONAME
-	_ZNK15CMSRPHeaderBase7ToTextLEv @ 103 NONAME
-	_ZNK15CMSRPHeaderBase8ToTextLCEv @ 104 NONAME
-	_ZNK16CMSRPMessageBase12ToPathHeaderEv @ 105 NONAME
-	_ZNK16CMSRPMessageBase14FromPathHeaderEv @ 106 NONAME
-	_ZNK16CMSRPMessageBase15ByteRangeHeaderEv @ 107 NONAME
-	_ZNK16CMSRPMessageBase15MessageIdHeaderEv @ 108 NONAME
-	_ZNK16CMSRPMessageBase17ContentTypeHeaderEv @ 109 NONAME
-	_ZNK16CMSRPMessageBase19FailureReportHeaderEv @ 110 NONAME
-	_ZNK16CMSRPMessageBase19SuccessReportHeaderEv @ 111 NONAME
-	_ZNK20CMSRPByteRangeHeader11EndPositionEv @ 112 NONAME
-	_ZNK20CMSRPByteRangeHeader11TotalLengthEv @ 113 NONAME
-	_ZNK20CMSRPByteRangeHeader13StartPositionEv @ 114 NONAME
-	_ZNK20CMSRPByteRangeHeader17ExternalizeValueLER12RWriteStream @ 115 NONAME
-	_ZNK20CMSRPMessageIdHeader17ExternalizeValueLER12RWriteStream @ 116 NONAME
-	_ZNK21CMSRPFromToHeaderBase17ExternalizeValueLER12RWriteStream @ 117 NONAME
-	_ZNK21CMSRPFromToHeaderBaseeqERKS_ @ 118 NONAME
-	_ZTI12CMSRPMessage @ 119 NONAME
-	_ZTI12CMSRPStrings @ 120 NONAME
-	_ZTI12CMSRPTlsPtrs @ 121 NONAME
-	_ZTI13CMSRPResponse @ 122 NONAME
-	_ZTI15CMSRPHeaderBase @ 123 NONAME
-	_ZTI16CMSRPMessageBase @ 124 NONAME
-	_ZTI17CMSRPToPathHeader @ 125 NONAME
-	_ZTI19CMSRPFromPathHeader @ 126 NONAME
-	_ZTI20CMSRPByteRangeHeader @ 127 NONAME
-	_ZTI20CMSRPMessageIdHeader @ 128 NONAME
-	_ZTI21CMSRPFromToHeaderBase @ 129 NONAME
-	_ZTI22CMSRPContentTypeHeader @ 130 NONAME
-	_ZTI24CMSRPFailureReportHeader @ 131 NONAME
-	_ZTI24CMSRPSuccessReportHeader @ 132 NONAME
-	_ZTV12CMSRPMessage @ 133 NONAME
-	_ZTV12CMSRPStrings @ 134 NONAME
-	_ZTV12CMSRPTlsPtrs @ 135 NONAME
-	_ZTV13CMSRPResponse @ 136 NONAME
-	_ZTV15CMSRPHeaderBase @ 137 NONAME
-	_ZTV16CMSRPMessageBase @ 138 NONAME
-	_ZTV17CMSRPToPathHeader @ 139 NONAME
-	_ZTV19CMSRPFromPathHeader @ 140 NONAME
-	_ZTV20CMSRPByteRangeHeader @ 141 NONAME
-	_ZTV20CMSRPMessageIdHeader @ 142 NONAME
-	_ZTV21CMSRPFromToHeaderBase @ 143 NONAME
-	_ZTV22CMSRPContentTypeHeader @ 144 NONAME
-	_ZTV24CMSRPFailureReportHeader @ 145 NONAME
-	_ZTV24CMSRPSuccessReportHeader @ 146 NONAME
+	_ZN11CMSRPReport12ExternalizeLER12RWriteStream @ 1 NONAME
+	_ZN11CMSRPReport12InternalizeLER11RReadStream @ 2 NONAME
+	_ZN11CMSRPReport8IsReportERK6TDesC8 @ 3 NONAME
+	_ZN11CMSRPReportC1Ev @ 4 NONAME
+	_ZN11CMSRPReportC2Ev @ 5 NONAME
+	_ZN11CMSRPReportD0Ev @ 6 NONAME
+	_ZN11CMSRPReportD1Ev @ 7 NONAME
+	_ZN11CMSRPReportD2Ev @ 8 NONAME
+	_ZN11MSRPStrings4PoolEv @ 9 NONAME
+	_ZN11MSRPStrings5CloseEv @ 10 NONAME
+	_ZN11MSRPStrings5OpenLER11RStringPool @ 11 NONAME
+	_ZN11MSRPStrings5OpenLEv @ 12 NONAME
+	_ZN11MSRPStrings5TableEv @ 13 NONAME
+	_ZN11MSRPStrings7StringFEi @ 14 NONAME
+	_ZN12CMSRPMessage10SetContentEP6HBufC8 @ 15 NONAME
+	_ZN12CMSRPMessage11GetFileNameEv @ 16 NONAME
+	_ZN12CMSRPMessage11SetFileNameERK4TBufILi256EE @ 17 NONAME
+	_ZN12CMSRPMessage12ExternalizeLER12RWriteStream @ 18 NONAME
+	_ZN12CMSRPMessage12InternalizeLER11RReadStream @ 19 NONAME
+	_ZN12CMSRPMessage6IsFileEv @ 20 NONAME
+	_ZN12CMSRPMessage7ContentEv @ 21 NONAME
+	_ZN12CMSRPMessage9IsMessageERK6TDesC8 @ 22 NONAME
+	_ZN12CMSRPMessageC1Ev @ 23 NONAME
+	_ZN12CMSRPMessageC2Ev @ 24 NONAME
+	_ZN12CMSRPMessageD0Ev @ 25 NONAME
+	_ZN12CMSRPMessageD1Ev @ 26 NONAME
+	_ZN12CMSRPMessageD2Ev @ 27 NONAME
+	_ZN13CMSRPResponse10IsResponseERK6TDesC8 @ 28 NONAME
+	_ZN13CMSRPResponse12ExternalizeLER12RWriteStream @ 29 NONAME
+	_ZN13CMSRPResponse12InternalizeLER11RReadStream @ 30 NONAME
+	_ZN13CMSRPResponse14SetStatusCodeLEj @ 31 NONAME
+	_ZN13CMSRPResponse15SetReasonPhraseE8RStringF @ 32 NONAME
+	_ZN13CMSRPResponseC1Ej8RStringF @ 33 NONAME
+	_ZN13CMSRPResponseC1Ev @ 34 NONAME
+	_ZN13CMSRPResponseC2Ej8RStringF @ 35 NONAME
+	_ZN13CMSRPResponseC2Ev @ 36 NONAME
+	_ZN13CMSRPResponseD0Ev @ 37 NONAME
+	_ZN13CMSRPResponseD1Ev @ 38 NONAME
+	_ZN13CMSRPResponseD2Ev @ 39 NONAME
+	_ZN15CMSRPHeaderBaseD0Ev @ 40 NONAME
+	_ZN15CMSRPHeaderBaseD1Ev @ 41 NONAME
+	_ZN15CMSRPHeaderBaseD2Ev @ 42 NONAME
+	_ZN16CMSRPMessageBase15SetStatusHeaderEP17CMSRPStatusHeader @ 43 NONAME
+	_ZN16CMSRPMessageBase15SetToPathHeaderEP17CMSRPToPathHeader @ 44 NONAME
+	_ZN16CMSRPMessageBase17SetFromPathHeaderEP19CMSRPFromPathHeader @ 45 NONAME
+	_ZN16CMSRPMessageBase18SetByteRangeHeaderEP20CMSRPByteRangeHeader @ 46 NONAME
+	_ZN16CMSRPMessageBase18SetMessageIdHeaderEP20CMSRPMessageIdHeader @ 47 NONAME
+	_ZN16CMSRPMessageBase20SetContentTypeHeaderEP22CMSRPContentTypeHeader @ 48 NONAME
+	_ZN16CMSRPMessageBase22SetFailureReportHeaderEP24CMSRPFailureReportHeader @ 49 NONAME
+	_ZN16CMSRPMessageBase22SetSuccessReportHeaderEP24CMSRPSuccessReportHeader @ 50 NONAME
+	_ZN16CMSRPMessageBaseD0Ev @ 51 NONAME
+	_ZN16CMSRPMessageBaseD1Ev @ 52 NONAME
+	_ZN16CMSRPMessageBaseD2Ev @ 53 NONAME
+	_ZN17CMSRPStatusHeader13SetStatusCodeEi @ 54 NONAME
+	_ZN17CMSRPStatusHeader17InternalizeValueLER11RReadStream @ 55 NONAME
+	_ZN17CMSRPStatusHeader4NewLEi @ 56 NONAME
+	_ZN17CMSRPStatusHeader5NewLCEi @ 57 NONAME
+	_ZN17CMSRPStatusHeaderD0Ev @ 58 NONAME
+	_ZN17CMSRPStatusHeaderD1Ev @ 59 NONAME
+	_ZN17CMSRPStatusHeaderD2Ev @ 60 NONAME
+	_ZN17CMSRPToPathHeader17InternalizeValueLER11RReadStream @ 61 NONAME
+	_ZN17CMSRPToPathHeader4NewLEP5CUri8 @ 62 NONAME
+	_ZN17CMSRPToPathHeader5NewLCEP5CUri8 @ 63 NONAME
+	_ZN17CMSRPToPathHeader7DecodeLERK6TDesC8 @ 64 NONAME
+	_ZN17CMSRPToPathHeaderD0Ev @ 65 NONAME
+	_ZN17CMSRPToPathHeaderD1Ev @ 66 NONAME
+	_ZN17CMSRPToPathHeaderD2Ev @ 67 NONAME
+	_ZN19CMSRPFromPathHeader17InternalizeValueLER11RReadStream @ 68 NONAME
+	_ZN19CMSRPFromPathHeader4NewLEP5CUri8 @ 69 NONAME
+	_ZN19CMSRPFromPathHeader5NewLCEP5CUri8 @ 70 NONAME
+	_ZN19CMSRPFromPathHeader7DecodeLERK6TDesC8 @ 71 NONAME
+	_ZN19CMSRPFromPathHeaderD0Ev @ 72 NONAME
+	_ZN19CMSRPFromPathHeaderD1Ev @ 73 NONAME
+	_ZN19CMSRPFromPathHeaderD2Ev @ 74 NONAME
+	_ZN20CMSRPByteRangeHeader14SetEndPositionEi @ 75 NONAME
+	_ZN20CMSRPByteRangeHeader14SetTotalLengthEi @ 76 NONAME
+	_ZN20CMSRPByteRangeHeader16SetStartPositionEi @ 77 NONAME
+	_ZN20CMSRPByteRangeHeader17InternalizeValueLER11RReadStream @ 78 NONAME
+	_ZN20CMSRPByteRangeHeader4NewLEiii @ 79 NONAME
+	_ZN20CMSRPByteRangeHeader5NewLCEiii @ 80 NONAME
+	_ZN20CMSRPByteRangeHeaderD0Ev @ 81 NONAME
+	_ZN20CMSRPByteRangeHeaderD1Ev @ 82 NONAME
+	_ZN20CMSRPByteRangeHeaderD2Ev @ 83 NONAME
+	_ZN20CMSRPMessageIdHeader17InternalizeValueLER11RReadStream @ 84 NONAME
+	_ZN20CMSRPMessageIdHeader4NewLERK6TDesC8 @ 85 NONAME
+	_ZN20CMSRPMessageIdHeader5NewLCERK6TDesC8 @ 86 NONAME
+	_ZN20CMSRPMessageIdHeaderD0Ev @ 87 NONAME
+	_ZN20CMSRPMessageIdHeaderD1Ev @ 88 NONAME
+	_ZN20CMSRPMessageIdHeaderD2Ev @ 89 NONAME
+	_ZN21CMSRPFromToHeaderBaseD0Ev @ 90 NONAME
+	_ZN21CMSRPFromToHeaderBaseD1Ev @ 91 NONAME
+	_ZN21CMSRPFromToHeaderBaseD2Ev @ 92 NONAME
+	_ZN22CMSRPContentTypeHeader17InternalizeValueLER11RReadStream @ 93 NONAME
+	_ZN22CMSRPContentTypeHeader4NewLERK6TDesC8 @ 94 NONAME
+	_ZN22CMSRPContentTypeHeader5NewLCERK6TDesC8 @ 95 NONAME
+	_ZN22CMSRPContentTypeHeaderD0Ev @ 96 NONAME
+	_ZN22CMSRPContentTypeHeaderD1Ev @ 97 NONAME
+	_ZN22CMSRPContentTypeHeaderD2Ev @ 98 NONAME
+	_ZN24CMSRPFailureReportHeader17InternalizeValueLER11RReadStream @ 99 NONAME
+	_ZN24CMSRPFailureReportHeader4NewLERK8RStringF @ 100 NONAME
+	_ZN24CMSRPFailureReportHeader5NewLCERK8RStringF @ 101 NONAME
+	_ZN24CMSRPFailureReportHeaderD0Ev @ 102 NONAME
+	_ZN24CMSRPFailureReportHeaderD1Ev @ 103 NONAME
+	_ZN24CMSRPFailureReportHeaderD2Ev @ 104 NONAME
+	_ZN24CMSRPSuccessReportHeader17InternalizeValueLER11RReadStream @ 105 NONAME
+	_ZN24CMSRPSuccessReportHeader4NewLERK8RStringF @ 106 NONAME
+	_ZN24CMSRPSuccessReportHeader5NewLCERK8RStringF @ 107 NONAME
+	_ZN24CMSRPSuccessReportHeaderD0Ev @ 108 NONAME
+	_ZN24CMSRPSuccessReportHeaderD1Ev @ 109 NONAME
+	_ZN24CMSRPSuccessReportHeaderD2Ev @ 110 NONAME
+	_ZNK12CMSRPMessage9IsContentEv @ 111 NONAME
+	_ZNK13CMSRPResponse10StatusCodeEv @ 112 NONAME
+	_ZNK13CMSRPResponse12ReasonPhraseEv @ 113 NONAME
+	_ZNK15CMSRPHeaderBase13ToTextValueLCEv @ 114 NONAME
+	_ZNK15CMSRPHeaderBase7ToTextLEv @ 115 NONAME
+	_ZNK15CMSRPHeaderBase8ToTextLCEv @ 116 NONAME
+	_ZNK16CMSRPMessageBase12StatusHeaderEv @ 117 NONAME
+	_ZNK16CMSRPMessageBase12ToPathHeaderEv @ 118 NONAME
+	_ZNK16CMSRPMessageBase14FromPathHeaderEv @ 119 NONAME
+	_ZNK16CMSRPMessageBase15ByteRangeHeaderEv @ 120 NONAME
+	_ZNK16CMSRPMessageBase15MessageIdHeaderEv @ 121 NONAME
+	_ZNK16CMSRPMessageBase17ContentTypeHeaderEv @ 122 NONAME
+	_ZNK16CMSRPMessageBase19FailureReportHeaderEv @ 123 NONAME
+	_ZNK16CMSRPMessageBase19SuccessReportHeaderEv @ 124 NONAME
+	_ZNK17CMSRPStatusHeader10StatusCodeEv @ 125 NONAME
+	_ZNK20CMSRPByteRangeHeader11EndPositionEv @ 126 NONAME
+	_ZNK20CMSRPByteRangeHeader11TotalLengthEv @ 127 NONAME
+	_ZNK20CMSRPByteRangeHeader13StartPositionEv @ 128 NONAME
+	_ZNK20CMSRPByteRangeHeader17ExternalizeValueLER12RWriteStream @ 129 NONAME
+	_ZNK20CMSRPMessageIdHeader17ExternalizeValueLER12RWriteStream @ 130 NONAME
+	_ZNK21CMSRPFromToHeaderBase17ExternalizeValueLER12RWriteStream @ 131 NONAME
+	_ZNK21CMSRPFromToHeaderBaseeqERKS_ @ 132 NONAME
+	_ZTI11CMSRPReport @ 133 NONAME ; #<TI>#
+	_ZTI12CMSRPMessage @ 134 NONAME ; #<TI>#
+	_ZTI12CMSRPStrings @ 135 NONAME ; #<TI>#
+	_ZTI12CMSRPTlsPtrs @ 136 NONAME ; #<TI>#
+	_ZTI13CMSRPResponse @ 137 NONAME ; #<TI>#
+	_ZTI15CMSRPHeaderBase @ 138 NONAME ; #<TI>#
+	_ZTI16CMSRPMessageBase @ 139 NONAME ; #<TI>#
+	_ZTI17CMSRPStatusHeader @ 140 NONAME ; #<TI>#
+	_ZTI17CMSRPToPathHeader @ 141 NONAME ; #<TI>#
+	_ZTI19CMSRPFromPathHeader @ 142 NONAME ; #<TI>#
+	_ZTI20CMSRPByteRangeHeader @ 143 NONAME ; #<TI>#
+	_ZTI20CMSRPMessageIdHeader @ 144 NONAME ; #<TI>#
+	_ZTI21CMSRPFromToHeaderBase @ 145 NONAME ; #<TI>#
+	_ZTI22CMSRPContentTypeHeader @ 146 NONAME ; #<TI>#
+	_ZTI24CMSRPFailureReportHeader @ 147 NONAME ; #<TI>#
+	_ZTI24CMSRPSuccessReportHeader @ 148 NONAME ; #<TI>#
+	_ZTV11CMSRPReport @ 149 NONAME ; #<VT>#
+	_ZTV12CMSRPMessage @ 150 NONAME ; #<VT>#
+	_ZTV12CMSRPStrings @ 151 NONAME ; #<VT>#
+	_ZTV12CMSRPTlsPtrs @ 152 NONAME ; #<VT>#
+	_ZTV13CMSRPResponse @ 153 NONAME ; #<VT>#
+	_ZTV15CMSRPHeaderBase @ 154 NONAME ; #<VT>#
+	_ZTV16CMSRPMessageBase @ 155 NONAME ; #<VT>#
+	_ZTV17CMSRPStatusHeader @ 156 NONAME ; #<VT>#
+	_ZTV17CMSRPToPathHeader @ 157 NONAME ; #<VT>#
+	_ZTV19CMSRPFromPathHeader @ 158 NONAME ; #<VT>#
+	_ZTV20CMSRPByteRangeHeader @ 159 NONAME ; #<VT>#
+	_ZTV20CMSRPMessageIdHeader @ 160 NONAME ; #<VT>#
+	_ZTV21CMSRPFromToHeaderBase @ 161 NONAME ; #<VT>#
+	_ZTV22CMSRPContentTypeHeader @ 162 NONAME ; #<VT>#
+	_ZTV24CMSRPFailureReportHeader @ 163 NONAME ; #<VT>#
+	_ZTV24CMSRPSuccessReportHeader @ 164 NONAME ; #<VT>#
 
--- a/Msrp/MsrpHeader/group/msrpheader.mmp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/group/msrpheader.mmp	Thu Nov 25 13:59:42 2010 +0200
@@ -14,7 +14,9 @@
 *
 */
 
-TARGET			msrpheader.dll
+#include <platform_paths.hrh>
+
+TARGET		    msrpheader.dll
 TARGETTYPE      dll
 UID             0x1000008d 0x2002B59D
 
@@ -23,22 +25,24 @@
 CAPABILITY      All -Tcb
 
 SOURCEPATH		../src
-SOURCE		CMSRPContentTypeHeader.cpp
-SOURCE		CMSRPFailureReportHeader.cpp
-SOURCE		CMSRPFromPathHeader.cpp
-SOURCE		CMSRPFromToHeaderBase.cpp
-SOURCE		CMSRPHeaderBase.cpp
-SOURCE		CMSRPMessage.cpp
-SOURCE		CMSRPResponse.cpp
-SOURCE		CMSRPSuccessReportHeader.cpp
-SOURCE		CMSRPToPathHeader.cpp
-SOURCE		CMSRPStrings.cpp
-SOURCE      CMSRPMessageIdHeader.cpp
-SOURCE      CMSRPByteRangeHeader.cpp
-SOURCE      MSRPStrings.cpp
-SOURCE      CMSRPTlsPtrs.cpp
-SOURCE      TMSRPHeaderUtil.cpp
-SOURCE      CMSRPMessageBase.cpp
+SOURCE		    CMSRPContentTypeHeader.cpp
+SOURCE		    CMSRPFailureReportHeader.cpp
+SOURCE		    CMSRPFromPathHeader.cpp
+SOURCE		    CMSRPFromToHeaderBase.cpp
+SOURCE		    CMSRPHeaderBase.cpp
+SOURCE		    CMSRPMessage.cpp
+SOURCE		    CMSRPResponse.cpp
+SOURCE		    CMSRPSuccessReportHeader.cpp
+SOURCE		    CMSRPToPathHeader.cpp
+SOURCE		    CMSRPStrings.cpp
+SOURCE          CMSRPMessageIdHeader.cpp
+SOURCE          CMSRPByteRangeHeader.cpp
+SOURCE          MSRPStrings.cpp
+SOURCE          CMSRPTlsPtrs.cpp
+SOURCE          TMSRPHeaderUtil.cpp
+SOURCE          CMSRPMessageBase.cpp
+SOURCE          CMSRPStatusHeader.cpp
+SOURCE          CMSRPReport.cpp
 
 
 START STRINGTABLE ../strings/MSRPStrConsts.st
@@ -48,7 +52,6 @@
 USERINCLUDE       ../inc
 USERINCLUDE       ../../inc 
 
-OS_LAYER_SYSTEMINCLUDE
 MW_LAYER_SYSTEMINCLUDE
 
 LIBRARY           inetprotutil.lib
@@ -56,8 +59,5 @@
 LIBRARY           estor.lib
 LIBRARY           bafl.lib
 LIBRARY           euser.lib
-LIBRARY 		  efsrv.lib
+LIBRARY		  efsrv.lib
 DEBUGLIBRARY      flogger.lib
-
-EXPORTUNFROZEN
-
--- a/Msrp/MsrpHeader/inc/CMSRPMessageBase.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/inc/CMSRPMessageBase.h	Thu Nov 25 13:59:42 2010 +0200
@@ -29,6 +29,7 @@
 class CMSRPContentTypeHeader;
 class CMSRPFailureReportHeader;
 class CMSRPSuccessReportHeader;
+class CMSRPStatusHeader;
 
 // CONSTANTS
 const TInt KMaxLengthOfShortMessage = 4096;
@@ -146,6 +147,19 @@
 		*/
 		IMPORT_C const CMSRPByteRangeHeader* ByteRangeHeader() const;
 
+        /**
+        * Sets/resets the Status header
+        * @param aStatus status header to be set, the ownership is transferred
+        */
+        IMPORT_C void SetStatusHeader( CMSRPStatusHeader* aStatus );
+
+        /**
+        * returns Status header
+        * @return status header, NULL if not present. Ownership is not
+        *         transferred.
+        */
+        IMPORT_C const CMSRPStatusHeader* StatusHeader( ) const;
+
 		/**
 		* Writes the object to a RWriteStream
 		* @param aWriteStream a stream where the object is to be externalized
@@ -176,7 +190,8 @@
         CMSRPFailureReportHeader* iFailureReport;
         // For setting and getting MSRP "Success-Report" header field
         CMSRPSuccessReportHeader* iSuccessReport;
-        
+        // For setting and getting MSRP "Status" header field
+        CMSRPStatusHeader* iStatusHeader;        
 	};
 
 #endif // CMSRPMESSAGEBASE_H
--- a/Msrp/MsrpHeader/inc/CMsrpMessage.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/inc/CMsrpMessage.h	Thu Nov 25 13:59:42 2010 +0200
@@ -89,19 +89,6 @@
 		 */
 		IMPORT_C TFileName& GetFileName( );
 		        
-		/* Set File Size */
-		IMPORT_C void SetFileSize( const TInt aFileSize );
-		
-		/* Get File Size */
-		IMPORT_C TInt GetFileSize();
-		
-		/* Set Granularity for file transfer */
-		        
-		IMPORT_C void SetNotifyProgress(TBool aNotify);
-		        
-		/* Get Granularity for file transfer */
-        IMPORT_C TBool GetNotifyProgress();        
-		        		
 		/**
 		* Internalizes the class from given stream
  		* @param aReadStream a stream containing the value of the
@@ -123,6 +110,11 @@
 		*        externalized object (header name not included).
         */
 	    void DoInternalizeL( RReadStream& aReadStream  );
+	    
+        /**
+        * Converts the buffer to file
+        */
+        void ConvertBufferToFileL( );
         
     private: // Data
 
@@ -131,12 +123,6 @@
 
 	   // filename
 	   TFileName iFileName;
-	   
-	   //filesize
-	   TInt iFileSize;
-	   
-	   //Granularity of the file
-	   TBool iNotifyProgress;
 	};
 
 #endif // CMSRPMESSAGE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Msrp/MsrpHeader/inc/CMsrpReport.h	Thu Nov 25 13:59:42 2010 +0200
@@ -0,0 +1,85 @@
+/*
+* ==============================================================================
+*  Name        : CMSRPReport.h
+*  Part of     : MSRP
+*  Description : MSRP report header
+*  Version     : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+*  Copyright © 2009 Nokia. All rights reserved.
+*  This material, including documentation and any related
+*  computer programs, is protected by copyright controlled by
+*  Nokia Corporation. All rights are reserved. Copying,
+*  including reproducing, storing, adapting or translating, any
+*  or all of this material requires the prior written consent of
+*  Nokia Corporation. This material also contains confidential
+*  information which may not be disclosed to others without the
+*  prior written consent of Nokia Corporation.
+* ==============================================================================
+*/
+
+#ifndef CMSRPREPORT_H
+#define CMSRPREPORT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <s32strm.h>
+
+#include "CMSRPMessageBase.h"
+
+// CLASS DECLARATION
+
+/**
+*  @publishedAll
+*
+*  Class provides functions for creation and manipulation of MSRP headers
+*/
+class CMSRPReport : public CMSRPMessageBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Constructor.
+        */
+	    IMPORT_C CMSRPReport();
+
+        /**
+        * Destructor.
+        */
+		IMPORT_C ~CMSRPReport();
+
+    public: // New functions
+
+		/**
+		* Check if the given externalised buffer contains MSRP Report
+ 		* @param aBuffer a Buffer containing the value of the
+		*        externalized object
+		* @return true if Buffer contains MSRP report
+		*/
+		IMPORT_C static TBool IsReport( const TDesC8& aBuffer );
+
+		/**
+		* Internalizes the class from given stream
+ 		* @param aReadStream a stream containing the value of the
+		*        externalized object
+		* @return Internalized CMSRPReport object, ownership is transferred
+		*/
+		IMPORT_C static CMSRPReport* InternalizeL( RReadStream& aReadStream );
+
+	public: // from base classes
+
+		// from CMSRPMessageBase
+		IMPORT_C void ExternalizeL( RWriteStream& aWriteStream );
+
+    private:
+
+        /**
+        * Internalizes this message
+ 		* @param aReadStream a stream containing the value of the
+		*        externalized object (header name not included).
+        */
+	    void DoInternalizeL( RReadStream& aReadStream  );
+	};
+
+#endif // CMSRPREPORT_H
+
+// End of File
--- a/Msrp/MsrpHeader/inc/CMsrpResponse.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/inc/CMsrpResponse.h	Thu Nov 25 13:59:42 2010 +0200
@@ -34,29 +34,12 @@
 */
 class CMSRPResponse : public CMSRPMessageBase
 	{
-    public:
-
-		/** Error codes */
-		enum TMSRPErrorCodes
-			{
-			EUnknownCode = 0,
-			EAllOk = 200,
-			EUnintelligibleRequest = 400,
-			EActionNotAllowed = 403,
-			ETimeout = 408,
-			EStopSending = 413,
-			EMimeNotUnderstood = 415,
-			EParameterOutOfBounds = 423,
-			ESessionDoesNotExist = 481,
-			EUnknownRequestMethod = 501,
-			ESessionAlreadyBound = 506
-			};
-
     public:  // Constructors and destructor
 
         /**
         * Constructor.
 	    * @param aStatusCode a known MSRP response status code.
+	    * @param aReasonPhrase status code in textual form
 	    * Cannot be 100.
         */
 		IMPORT_C CMSRPResponse( TUint aStatusCode, RStringF aReasonPhrase );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Msrp/MsrpHeader/inc/CMsrpStatusHeader.h	Thu Nov 25 13:59:42 2010 +0200
@@ -0,0 +1,132 @@
+/*
+* =============================================================================
+*  Name        : CMsrpStatusHeader.h
+*  Part of     : MSRP Client
+*  Interface   : SDK API, MSRP API
+*  Description :
+*  Version     : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+*  Copyright © 2007 Nokia. All rights reserved.
+*  This material, including documentation and any related
+*  computer programs, is protected by copyright controlled by
+*  Nokia Corporation. All rights are reserved. Copying,
+*  including reproducing, storing, adapting or translating, any
+*  or all of this material requires the prior written consent of
+*  Nokia Corporation. This material also contains confidential
+*  information which may not be disclosed to others without the
+*  prior written consent of Nokia Corporation.
+* =============================================================================
+*/
+
+#ifndef CMSRPSTATUSHEADER_H
+#define CMSRPSTATUSHEADER_H
+
+//  INCLUDES
+#include "CMsrpHeaderBase.h"
+
+// CONSTANTS
+const TInt KMaxLengthOfStatusCodeValue = 100;
+
+// CLASS DECLARATION
+/**
+* @publishedAll
+*
+* Class provides functions for setting and getting MSRP "Status" header field
+*
+* @lib msrpclient.lib
+*/
+class CMSRPStatusHeader : public CMSRPHeaderBase
+	{
+	public:	// Constructors and destructor
+
+		/**
+		* Creates a new instance of CMSRMessageIdHeader
+		* @param aStatusCode status code
+		* @return a new instance of CMSRPStatusHeader
+		*/
+		IMPORT_C static CMSRPStatusHeader* NewL( TInt aStatusCode );
+
+		/**
+		* Creates a new instance of CMSRPStatusHeader and puts it to CleanupStack
+		* @param aStatusCode status code
+		* @return a new instance of CMSRPStatusHeader
+		*/
+		IMPORT_C static CMSRPStatusHeader* NewLC( TInt aStatusCode );
+
+		/**
+		* Creates a new instance of CMSRMessageIdHeader
+		* @return a new instance of CMSRPStatusHeader
+		*/
+		static CMSRPStatusHeader* NewL( );
+
+		/**
+		* Destructor, deletes the resources of CMSRPStatusHeader.
+		*/
+		IMPORT_C ~CMSRPStatusHeader();
+
+	public: // New functions
+
+		/**
+		* Constructs an instance of a CMSRPStatusHeader from a RReadStream
+		* @param aReadStream a stream containing the value of the
+		*        externalized object (header name not included).
+		* @return an instance of a CMSRPStatusHeader
+		*/
+		IMPORT_C static CMSRPStatusHeader*
+			InternalizeValueL( RReadStream& aReadStream );
+
+		/**
+		* Sets the status code value
+		* @param aStatusCode status code
+		*/
+		IMPORT_C void SetStatusCode( TInt aStartPos );
+
+		/**
+		* Gets the status code value
+		*/
+		IMPORT_C TInt StatusCode( ) const;
+
+	public: // From CMSRPHeaderBase
+
+		IMPORT_C void ExternalizeValueL( RWriteStream& aWriteStream ) const;
+
+	public: // From CMSRPHeaderBase
+
+		RStringF Name() const;
+		HBufC8* ToTextValueL() const;
+
+	private: // Constructors
+
+        /**
+        * Contructor.
+        */
+		CMSRPStatusHeader( );
+        /**
+        * Contructor.
+		* @param aStatusCode status code
+        */
+		CMSRPStatusHeader( TInt aStatusCode );
+        /**
+        * two-phased contructor.
+        */
+        void ConstructL( ) const;
+
+	private: // new functions
+	    /**
+		* Internalize external object data
+		* @param aReadStream a stream containing the value of the
+		*        externalized object (header name not included).
+		*/
+		void DoInternalizeValueL( RReadStream& aReadStream );
+
+  	private: // variables
+
+		// status code value
+		TInt iStatusCode;
+
+	__DECLARE_TEST;
+	};
+
+#endif // CMSRPSTATUSHEADER_H
+
+// End of File
--- a/Msrp/MsrpHeader/src/CMSRPMessageBase.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/src/CMSRPMessageBase.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -29,6 +29,7 @@
 #include "CMsrpByteRangeHeader.h"
 #include "CMsrpFailureReportHeader.h"
 #include "CMsrpSuccessReportHeader.h"
+#include "CMsrpStatusHeader.h"
 
 // -----------------------------------------------------------------------------
 // CMSRPMessageBase::CMSRPMessageBase
@@ -51,6 +52,7 @@
 	delete iByteRange;
 	delete iFailureReport;
 	delete iSuccessReport;
+    delete iStatusHeader;
 	}
 
 // -----------------------------------------------------------------------------
@@ -245,4 +247,22 @@
     return NULL;
 	}
 
+// -----------------------------------------------------------------------------
+// CMSRPMessageBase::SetStatusHeaderL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMSRPMessageBase::SetStatusHeader( CMSRPStatusHeader* aStatus )
+    {
+    iStatusHeader = aStatus;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageBase::StatusHeader
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const CMSRPStatusHeader* CMSRPMessageBase::StatusHeader() const
+    {
+    return iStatusHeader;
+    }
+
 // End of File
--- a/Msrp/MsrpHeader/src/CMsrpMessage.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpHeader/src/CMsrpMessage.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -107,23 +107,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMSRPMessage::SetFileSize
-// -----------------------------------------------------------------------------
-//
-EXPORT_C void CMSRPMessage::SetFileSize( const TInt aFileSize )
-    {
-    iFileSize = aFileSize;
-    }
-
-// -----------------------------------------------------------------------------
-// CMSRPMessage::GetFileSize
-// -----------------------------------------------------------------------------
-//
-EXPORT_C TInt CMSRPMessage::GetFileSize( )
-    {
-    return iFileSize;
-    }
-// -----------------------------------------------------------------------------
 // CMSRPMessage::InternalizeL
 // -----------------------------------------------------------------------------
 //
@@ -205,32 +188,7 @@
                  aReadStream.ReadL( iFileName, nameLength );
                  break;
                 }
-            case 12: //filesize
-                 {
-                  TUint32 val = aReadStream.ReadUint32L();
-                  if( val > 0 )
-                    {
-                    HBufC8* tempString = HBufC8::NewLC( val );
-                    TPtr8 tempValue( tempString->Des() );
-                    aReadStream.ReadL( tempValue, val );
-                    iFileSize = TMSRPHeaderUtil::ConvertToNumber( tempString->Des() );
-                    CleanupStack::PopAndDestroy( tempString );
-                    }
-                   break;              
-                  }         
-            case 13: //granularity
-                  {
-                 TUint32 val = aReadStream.ReadUint32L();
-                 if( val > 0 )
-                    {
-                     HBufC8* tempString = HBufC8::NewLC( val );
-                     TPtr8 tempValue( tempString->Des() );
-                     aReadStream.ReadL( tempValue, val );
-                     iNotifyProgress = TMSRPHeaderUtil::ConvertToNumber( tempString->Des() );
-                     CleanupStack::PopAndDestroy( tempString );
-                     }
-                 break;              
-                  }                 
+                  
             default:
                 {
                 // nothing to do
@@ -285,35 +243,31 @@
             aWriteStream.WriteUint8L(7); // more headers in the stream flag
             iSuccessReport->ExternalizeValueL( aWriteStream );
             }
-        if ( IsContent() )
-            {
-            aWriteStream.WriteUint8L( 10 ); 
-            aWriteStream.WriteInt32L( iContentBuffer->Length()  );
-            aWriteStream.WriteL( *iContentBuffer, iContentBuffer->Length() );
-            }
         if ( IsFile() )
             {
             aWriteStream.WriteUint8L( 11 ); // 2 = file ID
             aWriteStream.WriteInt32L( iFileName.Length() );
             aWriteStream.WriteL( iFileName );
             }
-
-        if( iFileSize > 0 )
+        if ( IsContent() )
             {
-            aWriteStream.WriteUint8L( 12 );
-            TBuf8< 50 > val;
-            val.AppendNum( iFileSize );
-            aWriteStream.WriteInt32L( val.Length() );
-            aWriteStream.WriteL( val );
-             }
-        if( iNotifyProgress > 0 )
-            {
-            aWriteStream.WriteUint8L( 13 );
-            TBuf8< 50 > val;
-            val.AppendNum( iNotifyProgress );
-            aWriteStream.WriteInt32L( val.Length() );
-            aWriteStream.WriteL( val );
-             }
+            // let's check if the buffer length is larger than KMaxLengthOfSmallMSRPMessage
+            // if so, we must convert buffer to file
+            if ( iContentBuffer->Length() > KMaxLengthOfSmallMSRPMessage )
+                {
+                ConvertBufferToFileL();
+                aWriteStream.WriteUint8L( 11 );
+                aWriteStream.WriteInt32L( iFileName.Length() );
+                aWriteStream.WriteL( iFileName );
+                }
+            else
+                {
+                aWriteStream.WriteUint8L( 10 ); 
+                aWriteStream.WriteInt32L( iContentBuffer->Length()  );
+                aWriteStream.WriteL( *iContentBuffer, iContentBuffer->Length() );
+                }
+            }
+             
         aWriteStream.WriteUint8L(0); // no more headers in the stream flag
         }
 
@@ -344,14 +298,28 @@
       
 }
 
+// -----------------------------------------------------------------------------
+// CMSRPMessage::ConvertBufferToFileL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessage::ConvertBufferToFileL( )
+    {
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    RFile tempFile;
+    TFileName tempFileName;
 
-EXPORT_C void CMSRPMessage::SetNotifyProgress(TBool aNotify)
-      {
-      iNotifyProgress = aNotify;
-      }
-    
-EXPORT_C TBool CMSRPMessage::GetNotifyProgress()
-      {
-      return iNotifyProgress;
-      } 
+    // create temporary filename
+    User::LeaveIfError( tempFile.Temp(
+        fs, KDefaultTempFilePath, tempFileName, EFileShareExclusive | EFileWrite ) );
+
+    SetFileName( tempFileName );
+
+    tempFile.Write( 0, *iContentBuffer );
+    delete iContentBuffer;
+    iContentBuffer = NULL;
+    tempFile.Close();
+    fs.Close();
+    }
+      
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Msrp/MsrpHeader/src/CMsrpReport.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -0,0 +1,207 @@
+/*
+* =============================================================================
+*  Name          : CMSRPReport.cpp
+*  Part of       : MSRP API
+*  Version       : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+*  Copyright © 2009 Nokia. All rights reserved.
+*  This material, including documentation and any related
+*  computer programs, is protected by copyright controlled by
+*  Nokia Corporation. All rights are reserved. Copying,
+*  including reproducing, storing, adapting or translating, any
+*  or all of this material requires the prior written consent of
+*  Nokia Corporation. This material also contains confidential
+*  information which may not be disclosed to others without the
+*  prior written consent of Nokia Corporation.
+* =============================================================================
+*/
+
+// CLASS HEADER
+#include "CMSRPReport.h"
+
+// EXTERNAL INCLUDES
+//#include <e32base.h>
+#include <MsrpStrConsts.h>
+
+// INTERNAL INCLUDES
+#include "MsrpCommon.h"
+#include "CMSRPFromPathHeader.h"
+#include "CMSRPToPathHeader.h"
+#include "CMSRPMessageIdHeader.h"
+#include "CMSRPByteRangeHeader.h"
+#include "CMSRPContentTypeHeader.h"
+#include "CMSRPFailureReportHeader.h"
+#include "CMSRPSuccessReportHeader.h"
+#include "CMSRPStatusHeader.h"
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::CMSRPReport
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPReport::CMSRPReport()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::~CMSRPReport
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPReport::~CMSRPReport()
+	{
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::InternalizeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPReport* CMSRPReport::InternalizeL( RReadStream& aReadStream )
+	{
+	CMSRPReport* self = new (ELeave) CMSRPReport();
+	CleanupStack::PushL( self );
+    self->DoInternalizeL( aReadStream );
+	CleanupStack::Pop( self );
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::DoInternalizeL
+// -----------------------------------------------------------------------------
+//
+void CMSRPReport::DoInternalizeL( RReadStream& aReadStream )
+	{
+	TUint8 dataType( 0 );
+
+	// read the identifier
+	if ( aReadStream.ReadUint8L() != 102 )
+		{
+		User::Leave( KErrArgument );
+		}
+
+	do
+		{
+		dataType = aReadStream.ReadUint8L();
+
+		switch( dataType )
+			{
+			case 1: // from path
+				{
+				iFromPath = CMSRPFromPathHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 2: // to path
+				{
+				iToPath = CMSRPToPathHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 3: // message id
+				{
+				iMessageId = CMSRPMessageIdHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 4: // byte range
+				{
+				iByteRange = CMSRPByteRangeHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 5: // content type
+				{
+				iContentType = CMSRPContentTypeHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 6: // failure report
+				{
+				iFailureReport = CMSRPFailureReportHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 7: // success report
+				{
+				iSuccessReport = CMSRPSuccessReportHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+			case 8: // status
+				{
+				iStatusHeader = CMSRPStatusHeader::InternalizeValueL( aReadStream );
+				break;
+				}
+
+			default:
+				{
+				// nothing to do
+				break;
+				}
+			}
+
+		} while( dataType );
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::ExternalizeL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMSRPReport::ExternalizeL( RWriteStream& aWriteStream )
+	{
+	// first add the MSRP Message identifier
+	aWriteStream.WriteUint8L( 102 ); // MSRP Report identifier
+
+    if( iFromPath )
+        {
+		aWriteStream.WriteUint8L(1); // more headers in the stream flag
+        iFromPath->ExternalizeValueL( aWriteStream );
+        }
+    if( iToPath )
+        {
+		aWriteStream.WriteUint8L(2); // more headers in the stream flag
+        iToPath->ExternalizeValueL( aWriteStream );
+        }
+    if ( iMessageId )
+        {
+		aWriteStream.WriteUint8L(3); // more headers in the stream flag
+        iMessageId->ExternalizeValueL( aWriteStream );
+        }
+    if( iByteRange )
+        {
+        aWriteStream.WriteUint8L(4); // more headers in the stream flag
+        iByteRange->ExternalizeValueL( aWriteStream );
+        }
+    if( iContentType )
+        {
+        aWriteStream.WriteUint8L(5); // more headers in the stream flag
+        iContentType->ExternalizeValueL( aWriteStream );
+        }
+    if( iFailureReport )
+        {
+        aWriteStream.WriteUint8L(6); // more headers in the stream flag
+        iFailureReport->ExternalizeValueL( aWriteStream );
+        }
+    if( iSuccessReport )
+        {
+        aWriteStream.WriteUint8L(7); // more headers in the stream flag
+        iSuccessReport->ExternalizeValueL( aWriteStream );
+        }
+	if ( iStatusHeader )
+		{
+		aWriteStream.WriteUint8L( 8 );
+		iStatusHeader->ExternalizeValueL( aWriteStream );
+		}
+
+	aWriteStream.WriteUint8L(0); // no more headers in the stream flag
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPReport::IsReport
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMSRPReport::IsReport( const TDesC8& aBuffer )
+	{
+	if ( aBuffer.Length() )
+		{
+		if ( aBuffer[ 0 ] == 102 )
+			{
+			return ETrue;
+			}
+		}
+
+	return EFalse;
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Msrp/MsrpHeader/src/CMsrpStatusHeader.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -0,0 +1,294 @@
+/*
+* =============================================================================
+*  Name          : CMsrpStatusHeader.cpp
+*  Part of       : MSRP API
+*  Version       : %version: 1 % << Don't touch! Updated by Synergy at check-out.
+*
+*  Copyright © 2007 Nokia. All rights reserved.
+*  This material, including documentation and any related
+*  computer programs, is protected by copyright controlled by
+*  Nokia Corporation. All rights are reserved. Copying,
+*  including reproducing, storing, adapting or translating, any
+*  or all of this material requires the prior written consent of
+*  Nokia Corporation. This material also contains confidential
+*  information which may not be disclosed to others without the
+*  prior written consent of Nokia Corporation.
+* =============================================================================
+*/
+
+//CLASS HEADER
+#include "CMsrpStatusHeader.h"
+
+// EXTERNAL INCLUDES
+#include "msrpstrings.h"
+#include <msrpstrconsts.h>
+
+// EXTERNAL INCLUDES
+#include "MsrpCommon.h"
+#include "TMSRPHeaderUtil.h"
+#include "CMSRPResponse.h"
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::NewLC
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPStatusHeader* CMSRPStatusHeader::NewLC( TInt aStatusCode )
+	{
+	CMSRPStatusHeader* self = new (ELeave) CMSRPStatusHeader( aStatusCode );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::NewL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPStatusHeader* CMSRPStatusHeader::NewL( TInt aStatusCode )
+	{
+	CMSRPStatusHeader* self = CMSRPStatusHeader::NewLC( aStatusCode );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::NewL
+// -----------------------------------------------------------------------------
+//
+CMSRPStatusHeader* CMSRPStatusHeader::NewL( )
+	{
+	CMSRPStatusHeader* self = new (ELeave) CMSRPStatusHeader( );
+    CleanupStack::PushL( self );
+    self->ConstructL( );
+	CleanupStack::Pop( self );
+    return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::CMSRPStatusHeader
+// -----------------------------------------------------------------------------
+//
+CMSRPStatusHeader::CMSRPStatusHeader( TInt aStatusCode )
+	: iStatusCode( aStatusCode )
+    {
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::CMSRPStatusHeader
+// -----------------------------------------------------------------------------
+//
+CMSRPStatusHeader::CMSRPStatusHeader( )
+    {
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMSRPStatusHeader::ConstructL( ) const
+	{
+	MSRPStrings::OpenL();
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::~CMSRPStatusHeader
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPStatusHeader::~CMSRPStatusHeader()
+	{
+	MSRPStrings::Close();
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::InternalizeValueL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMSRPStatusHeader* CMSRPStatusHeader::InternalizeValueL(
+	RReadStream& aReadStream )
+	{
+	CMSRPStatusHeader* self = CMSRPStatusHeader::NewL( );
+	CleanupStack::PushL( self );
+	self->DoInternalizeValueL( aReadStream );
+	CleanupStack::Pop( self );
+	return self;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::SetStartPosition
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMSRPStatusHeader::SetStatusCode( TInt aStatusCode )
+	{
+	iStatusCode = aStatusCode;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::StatusCode
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMSRPStatusHeader::StatusCode( ) const
+	{
+	return iStatusCode;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::DoInternalizeValueL
+// -----------------------------------------------------------------------------
+//
+void CMSRPStatusHeader::DoInternalizeValueL( RReadStream& aReadStream )
+	{
+	TUint32 valueLength = aReadStream.ReadUint32L();
+    if( valueLength > 0 )
+        {
+		HBufC8* tempString = HBufC8::NewLC( valueLength );
+	    TPtr8 tempValue( tempString->Des() );
+	    aReadStream.ReadL( tempValue, valueLength );
+		iStatusCode = TMSRPHeaderUtil::ConvertToNumber( tempString->Des() );
+		CleanupStack::PopAndDestroy( tempString );
+		}
+	else
+		{
+		User::Leave( KErrArgument );
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::ExternalizeValueL
+// From CSIPHeaderBase:
+// -----------------------------------------------------------------------------
+//
+void CMSRPStatusHeader::ExternalizeValueL( RWriteStream& aWriteStream ) const
+	{
+	TBuf8< KMaxLengthOfStatusCode > value;
+	// status code
+	value.AppendNum( iStatusCode, EDecimal );
+	aWriteStream.WriteInt32L( value.Length() );
+	aWriteStream.WriteL( value );
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::Name
+// -----------------------------------------------------------------------------
+//
+RStringF CMSRPStatusHeader::Name() const
+	{
+	return MSRPStrings::StringF( MSRPStrConsts::EStatus );
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::ToTextValueL
+// -----------------------------------------------------------------------------
+//
+HBufC8* CMSRPStatusHeader::ToTextValueL() const
+	{
+	TBuf8< KMaxLengthOfStatusCodeValue > statusCodeLine;
+	TMSRPHeaderUtil::AppendStringL(
+		MSRPStrings::StringF( MSRPStrConsts::EStatusNameSpace ).DesC(), statusCodeLine );
+	TMSRPHeaderUtil::AppendStringL( KSpaceChar, statusCodeLine );
+
+	statusCodeLine.AppendNum( iStatusCode, EDecimal );
+	TMSRPHeaderUtil::AppendStringL( KSpaceChar, statusCodeLine );
+
+	// then is the reason string
+	// possible codes are defined here
+	switch( iStatusCode )
+		{
+		case EAllOk:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EAllOk ).DesC(), statusCodeLine );
+			break;
+			}
+		case EUnintelligibleRequest:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EUnintelligibleRequest ).DesC(), statusCodeLine );
+			break;
+			}
+		case EActionNotAllowed:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EActionNotAllowed ).DesC(), statusCodeLine );
+			break;
+			}
+		case ETimeout:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::ETimeout ).DesC(), statusCodeLine );
+			break;
+			}
+		case EStopSending:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EStopSending ).DesC(), statusCodeLine );
+			break;
+			}
+		case EMimeNotUnderstood:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EMimeNotUnderstood ).DesC(), statusCodeLine );
+			break;
+			}
+		case EParameterOutOfBounds:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EParameterOutOfBounds ).DesC(), statusCodeLine );
+			break;
+			}
+		case ESessionDoesNotExist:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::ESessionDoesNotExist ).DesC(), statusCodeLine );
+			break;
+			}
+		case EUnknownRequestMethod:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::EUnknownRequestMethod ).DesC(), statusCodeLine );
+			break;
+			}
+		case ESessionAlreadyBound:
+			{
+			TMSRPHeaderUtil::AppendStringL(
+				MSRPStrings::StringF(
+				MSRPStrConsts::ESessionAlreadyBound ).DesC(), statusCodeLine );
+			break;
+			}
+
+		default:
+			{
+			// not a valid code
+			User::Leave( KErrArgument );
+			break;
+			}
+		}
+
+
+	HBufC8* tempString = HBufC8::NewLC( statusCodeLine.Length() );
+	*tempString = statusCodeLine;
+	CleanupStack::Pop( tempString );
+
+	return tempString;
+	}
+
+// -----------------------------------------------------------------------------
+// CMSRPStatusHeader::__DbgTestInvariant
+// -----------------------------------------------------------------------------
+//
+void CMSRPStatusHeader::__DbgTestInvariant() const
+	{
+#if defined(_DEBUG)
+	// to be defined
+#endif
+	}
+
+// End of File
--- a/Msrp/MsrpServer/group/msrpserver.mmp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/group/msrpserver.mmp	Thu Nov 25 13:59:42 2010 +0200
@@ -14,6 +14,8 @@
 *
 */
 
+#include <platform_paths.hrh>
+
 // Capability assignment.
 CAPABILITY ProtServ NetworkControl NetworkServices Location \
 ReadDeviceData WriteDeviceData
@@ -33,7 +35,6 @@
 USERINCLUDE     ../../inc
 USERINCLUDE     ../../msrpheader/inc
 
-OS_LAYER_SYSTEMINCLUDE
 MW_LAYER_SYSTEMINCLUDE
 
 SOURCEPATH      ../src
@@ -55,7 +56,6 @@
 SOURCE 			CMSRPMsgParser.cpp 
 SOURCE			TStateFactory.cpp 
 SOURCE			TStates.cpp 
-SOURCE          CMSRPMessageChunkState.cpp
 
 
 
@@ -67,6 +67,7 @@
 LIBRARY         bafl.lib
 LIBRARY         random.lib
 DEBUGLIBRARY    flogger.lib
+#undef __SERIES60_
 #if defined(__SERIES60_)
 LIBRARY		  	extendedconnpref.lib
 LIBRARY 	  	netmeta.lib
--- a/Msrp/MsrpServer/inc/CMSRPConnection.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPConnection.h	Thu Nov 25 13:59:42 2010 +0200
@@ -66,8 +66,12 @@
 
         virtual void ReleaseConnection(MMSRPConnectionObserver& aSubsession);
                                     
-        virtual void SendL( MMSRPWriterObserver& aMsg /*, MMSRPConnectionObserver& aSubsession*/  );
-                                                             
+        void SendL( MMSRPWriterObserver& aMsg );
+   
+        void ContinueSendingL( MMSRPWriterObserver& aMsg );
+   
+        void CancelSendingL( const MMSRPWriterObserver* aMsg );
+   
         virtual void ConnectionEstablishedL( TInt aNewState, RSocket* aSocket, TInt aStatus );
 
 		virtual TInt getConnectionState();
@@ -76,12 +80,13 @@
         
         //virtual void ConnectionEstablishedL( TInt aNewState, RSocket* aDataSocket, TInt aStatus );
         
-        //from MMSRPReaderObserver
+	public: //from MMSRPReaderObserver
 
         virtual void ReadStatusL(RMsrpBuf& aBuf, TInt aStatus);
         
-        //from MMSRPParserObserver
-        virtual void ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus);
+   public: //from MMSRPParserObserver
+        TInt ParseStatusL ( CMSRPMessageHandler* aMsg, TInt aStatus );
+        void ReportReceiveprogressL(  CMSRPMessageHandler* aMsg ); 
                                         
         //from MMSRPWriterErrorObserver
         virtual void WriteSocketError(TInt aError);
--- a/Msrp/MsrpServer/inc/CMSRPConnectionManager.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPConnectionManager.h	Thu Nov 25 13:59:42 2010 +0200
@@ -18,13 +18,14 @@
 #define CMSRPCONNECTIONMANAGER_H
 
 // INCLUDES
+#include <CommDbConnPref.h>
+
 #include "MMSRPConnectionManager.h"
 #include "MMSRPConnectionManagerObserver.h"
 #include "MMSRPListenerObserver.h"
 #include "MMSRPListener.h"
 #include "MMSRPConnection.h"
 
-
 // FORWARD DECLARATIONS
 class MMSRPConnectionManagerObserver;
 class MMSRPConnection;
@@ -47,33 +48,21 @@
         virtual ~CMSRPConnectionManager();
 
 
-    /*Functions from base classes*/   
-        /* from MMSRPConnectionManager*/
-        
-        virtual void ResolveLocalIPAddressL( TInetAddr& aLocalAddr );
-       
-        virtual MMSRPConnection& getConnectionL( TDesC8& aHost, TUint aPort );
-          
-        
-     //called by conn   
-        virtual void ListenL(MMSRPConnection* aConnection);
+    public: // from MMSRPConnectionManager
         
-        virtual void ListenCancel(MMSRPConnection* aConnection);
+        void ResolveLocalIPAddressL( TInetAddr& aLocalAddr );
+        MMSRPConnection& getConnectionL( TDesC8& aHost, TUint aPort );
+        void ListenL(MMSRPConnection* aConnection);
+        void ListenCancel(MMSRPConnection* aConnection);
+        void Remove(MMSRPConnection* aConnection);
+        RSocketServ& SocketServer();	            
+        RConnection& SocketServerConn() ;        
+        TInt ReStartInterface();
         
-        virtual void Remove(MMSRPConnection* aConnection);
-	    
-        virtual RSocketServ& SocketServer();	            
-	    
-        virtual RConnection& SocketServerConn() ;        
-        
-        //virtual TBool MatchIapId(TUint32 aIapID);
-        
-        
-        /* from MMSRPListenerObserver  */
+    public: // from MMSRPListenerObserver
+    
         virtual void ListenerStateL( TInt aNewState, RSocket* aDataSocket, TInt aStatus );
                 
-        
-
 	private: 
 	    
     // internal functions
@@ -92,8 +81,7 @@
 	     */
 	    TInt StartInterface();
 	    
-
-	// constructors
+	private: // constructors
 
 	    CMSRPConnectionManager( const TUint32 aIapID, MMSRPConnectionManagerObserver& aServer );
         
@@ -110,6 +98,9 @@
 		TUint32           iIapID;
 		TInetAddr         iLocalAddr;
 		
+		// connection preferences
+        TCommDbConnPref iConnectionPreferences;
+		
 		MMSRPConnectionManagerObserver& iObserver;
     };
 
--- a/Msrp/MsrpServer/inc/CMSRPMessageChunkState.h	Sat Jun 12 14:30:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html."
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-* Contributors:
-*
-* Description:
-* MSRP Implementation
-*
-*/
-
-#ifndef CMSRPMESSAGECHUNKSTATE_H_
-#define CMSRPMESSAGECHUNKSTATE_H_
-
-// System Includes
-#include <e32base.h>
-#include <in_sock.h>
-
-const TInt KMaxLgthOfTransactionIdString = 100;
-
-
-class CMSRPMessageChunkState : public CBase
-    {
-    
-public: // Constructors and destructor
-       IMPORT_C static CMSRPMessageChunkState* NewL( );  
-       IMPORT_C ~CMSRPMessageChunkState();
-       
-       
-       IMPORT_C TBool GetResponseReceived( );
-       IMPORT_C void SetResponseReceived(TBool aResponseReceived);
-       IMPORT_C TDesC8& GetTransactionId( );
-       IMPORT_C void SetTransactionId(TDesC8& aTransactionId );
-       IMPORT_C void SetStartPos(TInt aStartPos);
-       IMPORT_C void SetEndPos(TInt aEndPos);
-       IMPORT_C TInt GetStartPos( );
-       IMPORT_C TInt GetEndPos( );
-       IMPORT_C void SetResponseSent(TBool aResponseSent);
-       IMPORT_C TBool GetResponseSent( );
-       
-private:    
-       
-       CMSRPMessageChunkState();    
-      // void ConstructL();
-       
-       
-
-   
-private:
-         TInt iStartPos;
-         TInt iEndPos;
-         TBuf8< KMaxLgthOfTransactionIdString > iTransactionId;
-         TBool iResponseReceived;
-         TBool iResponseSent;
-    };
-
-
-
-
-
-#endif /* CMSRPMESSAGECHUNKSTATE_H_ */
-
-
-
-
-
--- a/Msrp/MsrpServer/inc/CMSRPMessageHandler.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPMessageHandler.h	Thu Nov 25 13:59:42 2010 +0200
@@ -26,7 +26,6 @@
 #include "MMSRPIncomingMessage.h"
 #include "MMSRPOutgoingMessage.h"
 #include "MMSRPWriterObserver.h"
-#include "CMSRPMessageChunkState.h"
 
 // Forward declarations
 class MMSRPMessageHandler;
@@ -41,202 +40,291 @@
 class RStringF;
 
 // Constants
-const TInt KMaxBufferSize = 2500;
+//const TInt KMaxBufferSize = 2500;
+const TInt KMaxBufferSize = 10000;
 const TInt KSmallBuffer = 1024;
 const TInt KMaxChunkReadSize =  65000;
 // Class declaration
 
-/* MSRP Message handler
- * 
+/*
+ * MSRP message handler class. Each MSRP message creates an instance of this class
+ * THis class handles both incoming and outgoing messages
  */
-
 class CMSRPMessageHandler : public CBase, public MMSRPMessageHandler, 
                             public MMSRPIncomingMessage, public MMSRPOutgoingMessage, 
                             public MMSRPWriterObserver
     {
-public:
-    
-    enum TMSRPMessageState
-        {
-        EIdle,
-        EInProgress,
-        EChunkSent,
-        EMessageSent,
-        EWaitingForResponse,
-        EWaitingForReport,        
-        EMessageDone
-        };
+    public:
         
-    /* Two-Phased constructor
-     * 
-     */
-    static CMSRPMessageHandler* NewL( MMSRPMessageObserver* aMessageObserver, 
-            const TDesC8& aMessage );
+        enum TMSRPMessageState
+            {
+            EIdle,                // 0
+            EInProgress,          // 1
+            EChunkSent,           // 2
+            EMessageSent,         // 3
+            ETerminated ,         // 4
+            EWaitingForResponse,  // 5
+            EWaitingForReport,    // 6
+            EMessageDone          // 7
+            };
+            
+        /* Two-Phased constructor
+         * 
+         */
+        static CMSRPMessageHandler* NewL( MMSRPMessageObserver* aMessageObserver, 
+                const TDesC8& aMessage );
+        
+        static CMSRPMessageHandler* NewLC( MMSRPMessageObserver* aMessageObserver, 
+                const TDesC8& aMessage );
+        
+        static CMSRPMessageHandler* NewL( TMSRPMessageType aMessageType );
+        
+        static CMSRPMessageHandler* NewLC( TMSRPMessageType aMessageType );
+        
+        /**
+         * Destructor.
+         */
+        ~CMSRPMessageHandler();
     
-    static CMSRPMessageHandler* NewLC( MMSRPMessageObserver* aMessageObserver, 
-            const TDesC8& aMessage );
-    
-    static CMSRPMessageHandler* NewL( TMSRPMessageType aMessageType );
-    
-    static CMSRPMessageHandler* NewLC( TMSRPMessageType aMessageType );
-    
-    /**
-     * Destructor.
-     */
-    ~CMSRPMessageHandler();
-
-	static TInt LinkOffset();		
-	TSglQueLink iLink;	
-    
-public: // From base classes
-    
-    // From MMSRPWriterObserver
-	TWriteStatus GetSendBufferL( TPtrC8& aData, TBool aInterrupt ); 
-    
-    MMSRPWriterObserver::TMsgStatus WriteDoneL( TInt aStatus );
+        static TInt LinkOffset();		
+        TSglQueLink iLink;
+        
+        /**
+         * Get message id of the current message
+         * @return message id of the message, ownership is transferred
+         */
+        HBufC8* MessageIdLC( ); 
+        
+        /**
+         * Get currently received bytes in this message handler
+         * @param aBytesTransferred number of transferred bytes
+         * @param aTotalBytes total size of data
+         */
+        void CurrentReceiveProgress( TInt& aBytesTransferred, TInt& aTotalBytes ); 
     
-    // From MMSRPMessageHandler
-    void AddHeaderL( TMsrpHeaderType aHeaderType, TPtrC8& aHeaderValue, 
-            TPtrC8& aHeaderTypeAndValue );
-    
-    void AddContentL( TPtrC8& aContent );
-    
-    void SetTransactionId( TPtrC8& aTransactionId );
-    
-    void SetStatusOfResponseL( TPtrC8& aStatusCode, TPtrC8& aStatusMessage );
+        /**
+         * Get currently transferred bytes in this message handler
+         * @param aBytesTransferred number of transferred bytes
+         * @param aTotalBytes total size of data
+         */
+        void CurrentSendProgress( TInt& aBytesTransferred, TInt& aTotalBytes ); 
     
-    void EndOfMessageL( TMsrpMsgEndStatus aStatus );
+        /**
+         * Sets the message observer entoty
+         * @param aMessageObserver MMSRPMessageObserver
+         */
+        void SetMessageObserver( MMSRPMessageObserver* aMessageObserver ); 
     
-    // From MMSRPIncomingMessage
-    TMSRPMessageType MessageType( );
-       
-    CMSRPMessage* GetIncomingMessage( );
+        /**
+         * Checks whether we are sending or receiving a message with this handler
+         * @return true if we are sending a message
+         */
+        TBool IsSending( ); 
     
-    TBool SendResponseL( MMSRPMessageObserver* aMessageObserver,
-								MMSRPConnection& aConnection, TUint aResponseCode );
+        /**
+         * returns the temporary file name
+         * @return temporary filename which contains incoming data
+         */
+        TFileName& TemporaryFileName( ); 
     
-    TDesC8& TransactionId( );
-        
-    CMSRPResponse* GetIncomingResponse( );
-        
-    // From MMSRPOutgoingMessage
-    void SendMessageL( MMSRPConnection& aConnection );
-        
-    TBool IsOwnerOfResponse( MMSRPIncomingMessage& aIncomingMessage );
+        /**
+         * Set the temporary file name. Used when message is divided to multiple chunks
+         * @param afilename temporary File name
+         */
+        void SetTemporaryFileName( TFileName aFileName ); 
     
-    TBool ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage );
+        /**
+         * Response is no longer needed, it can be deleted
+         */
+        void ResponseHandled( ); 
+
+        /**
+         * Terminates the receiving of message
+         * @param aConnection connection instance
+         * @param aMessageObserver observer for completed send response
+         */
+        void TerminateReceiving( MMSRPMessageObserver* aMessageObserver, 
+                MMSRPConnection& aConnection );
 
-    TBool IsMessageComplete();
-    
-    TBool GetSendResultL( TUint &aErrorCode, HBufC8* &aMessageId );
-    
-    void SendFileL( MMSRPConnection& aConnection );
-        
-    void ConsumeFileResponseL( MMSRPIncomingMessage& aIncomingMessage );
-       
+        /**
+         * Terminates the sending of message
+         */
+        void TerminateSending( );
 
+        /**
+         * Returns true if message sending or receiving is terminated
+         * @return true if FS is terminated
+         */
+        TBool IsTransmissionTerminated( );
+
+        /**
+         * Returns true if REPORT response was requested
+         * @return true if REPORT must be sent
+         */
+        TBool IsReportNeeded( );
 
-    TBool IsInFile();
-       
-    void ReceiveFileL( );
-       
-    TBool FileTransferComplete( );
-       
-    void WritetoFileL(CMSRPMessageHandler *aIncomingMsgHandler );
-       
-    void UpdateResponseStateL(CMSRPMessageHandler *incomingMsgHandler);
-       
-    TBool IfResponseReqL();
-private:
-    // Constructor
-    CMSRPMessageHandler( MMSRPMessageObserver* aMessageObserver );
-    
-    CMSRPMessageHandler( );
-    
-    void ConstructL( const TDesC8& aMessage );
-    
-    void ConstructL( TMSRPMessageType aMessageType );
-    
-    // Member Functions
-    void CreateByteRangeHeaderL();
+    public: // From base classes
+        
+        // From MMSRPWriterObserver
+        const TDesC8& GetSendBufferL( TWriteStatus& aStatus, TBool aInterrupt ); 
+        
+        MMSRPWriterObserver::TMsgStatus WriteDoneL( TInt aStatus );
+        
+        // From MMSRPMessageHandler
+        void AddHeaderL( TMsrpHeaderType aHeaderType, TPtrC8& aHeaderValue, 
+                TPtrC8& aHeaderTypeAndValue );
+        
+        void AddContentL( TPtrC8& aContent, TBool aByteRangeFound = EFalse );
+        
+        void SetTransactionId( TDesC8& aTransactionId );
+        
+        void SetStatusOfResponseL( TPtrC8& aStatusCode, TPtrC8& aStatusMessage );
+        
+        void EndOfMessageL( TMsrpMsgEndStatus aStatus );
+        TBool CheckMessageChunkL( CMSRPMessageHandler& aOtherMessage );
+        
+    public: // From MMSRPIncomingMessage
+        TMSRPMessageType MessageType( );
+        CMSRPMessage* GetIncomingMessage( ) const;
+        void SendResponseL( MMSRPMessageObserver* aMessageObserver,
+                                    MMSRPConnection& aConnection, TUint aResponseCode );
+        TBool SendReportL( MMSRPMessageObserver* aMessageObserver, 
+                                        MMSRPConnection& aConnection, TUint aStatusCode );
+        TDesC8& TransactionId( );
+        CMSRPResponse* GetIncomingResponse( ) const;
+        CMSRPReport* GetIncomingReport( ) const;
+            
+    public: // From MMSRPOutgoingMessage
     
-    void CreateTransactionId();
-    
-    void WriteInitialLineToBufferL();
-    
-    void WriteHeadersToBufferL();
-    
-    void WriteContentToBuffer();
-    
-    void WriteFileContentToBufferL();
-    
-    void WriteEndLineToBuffer(TMsrpMsgEndStatus = EMessageEnd );
+        void SendMessageL( MMSRPConnection& aConnection );
+        TBool IsOwnerOfResponse( MMSRPIncomingMessage& aIncomingMessage );
+        TUint ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage );
+        TBool IsMessageComplete();
+        TUint GetSendResultL( HBufC8* &aMessageId );
+        TBool IsFailureHeaderPartial(); 
+        
+    private:
+        // Constructor
+        CMSRPMessageHandler( MMSRPMessageObserver* aMessageObserver );
+        
+        CMSRPMessageHandler( );
+        
+        void ConstructL( const TDesC8& aMessage );
+        
+        void ConstructL( TMSRPMessageType aMessageType );
+        
+        // Member Functions
+        void CreateByteRangeHeaderL();
+        
+        void CreateTransactionIdL();
+        
+        void WriteInitialLineToBufferL();
+        
+        void WriteHeadersToBufferL();
+        
+        void WriteContentToBuffer();
+        
+        void WriteFileContentToBufferL();
+        
+        void WriteEndLineToBuffer(TMsrpMsgEndStatus = EMessageEnd );
+        
+        TInt ExtractByteRangeParams( TDesC8& aHeaderValue, TInt& aStartPos, 
+                TInt& aEndPos, TInt& aTotal );
+        
+        RStringF GetStatusStringL( TUint aStatusCode );
+        
+        TUint CheckValidityOfMessage( TMSRPMessageType aMessageType, 
+                CMSRPMessageBase* aMessage );
+        
+        TInt FillFileBufferL();
+             
+        /*
+        * Opens temporary file. Name of the file is save to iTempFileName
+        * and Rfile is in iTempFile
+        */
+        void CreateTemporaryFileL( );
     
-    TInt ExtractByteRangeParams( TDesC8& aHeaderValue, TInt& aStartPos, 
-            TInt& aEndPos, TInt& aTotal );
+        /*
+        * Opens temporary file. Name of the file is save to iTempFileName
+        * and Rfile is in iTempFile
+        * @param aFilename filename to open
+        */
+        void OpenTemporaryFileL( const TDesC& aFilename );
     
-    RStringF GetStatusStringL( TUint aStatusCode );
+        /*
+        * Writes the given buffer to a file
+        * @param aBuffer buffer to be written into the file
+        */
+        void WriteMessageToFileL( TDesC8& aBuffer );
     
-    TUint CheckValidityOfMessage( TMSRPMessageType aMessageType, 
-            CMSRPMessageBase* aMessage );
+        /*
+        * The message continues and a new segment of the message is being
+        * written to the end of file. 
+        * @param aBuffer buffer to be written into the file
+        */
+        void AppendMessageToFileL( TDesC8& aBuffer );
+        
+    private:
+        
+        // Server interface
+        MMSRPMessageObserver* iMSRPMessageObserver;
+        
+        // array of sent chunks, transaction id is saved from
+        // sent chunks
+        RPointerArray< HBufC8 > iSentChunks;
+                
+        // MSRP Report
+        CMSRPReport* iReport;
     
-    TInt FillFileBufferL();
-         
-    void SendFileChunkL( MMSRPConnection& aConnection );
-       
-        
+        // MSRP response;
+        CMSRPResponse* iResponse;
 
-    void SendFileStateL( TInt aBytes );
+        // MSRP message
+        CMSRPMessage* iMessage;
+
+        TBool iResponseNeeded;
+        
+        RBuf8 iBuffer;
         
-    void ReceiveFileStateL( TInt aBytes );
+        TPtrC8 iContentPtr;
+        
+        TBool iWriteDone;    
+        
+        TMSRPMessageType iActiveMsgType;
+        
+        TMSRPMessageState iState;
+        
         
-    void WriteChunkToFileL(const TDesC8& aFileChunk ,TDesC8& aTransactionId);  
-private:
-    
-    // Server interface
-    MMSRPMessageObserver* iMSRPMessageObserver;
-    
-    // Transaction Id
-    TBuf8< KMaxLengthOfTransactionIdString > iTransactionId;
-            
-    // MSRP Message
-    CMSRPMessage* iMessage;
-
-    // MSRP response;
-    CMSRPResponse* iResponse;
-    
-    TBool iResponseNeeded;
-    
-    RBuf8 iBuffer;
-    
-    TPtrC8 iContentPtr;
+        /* For File Use Case */
+        RFile iFile;
+        RFs iFs;
+        TInt iFileSize;
+        TBool isSending;
+        
+        TBool iInterrupt;
+        HBufC8* iFileBuffer;
+        TBool iFileTransferComplete;
+        TInt iBufPosInFile; //file buffer start pos in file
+        TInt iEndPosInBuffer;    
+        TInt iStartPosInBuffer;
+        TInt iFileBytesSent;    
+        TBool iTerminateReceiving;
+        TBool iTerminateSending;
     
-    TBool iWriteDone;    
-    
-    TMSRPMessageType iActiveMsgType;
-    
-    TMSRPMessageState iState;
-    
-    TMsrpMsgEndStatus iMsgEndStatus;        
+        TInt iNotifiedBytes;
+        TInt iPendingBytes;
+        
+        /// temporary file name which is used
+        TFileName iTempFileName;
     
-    /* For File Use Case */
-    TBool isFile; 
-    RFile iFile;
-    RFs iFs;
-    TInt iFileSize;
-    
-    TBool iInterrupt;
-    HBufC8* iFileBuffer;
-    TBool iFileTransferComplete;
-    RPointerArray <CMSRPMessageChunkState> iChunkList;       
-    TInt iBufPosInFile; //file buffer start pos in file
-    TInt iEndPosInBuffer;    
-    TInt iStartPosInBuffer;
-    TInt iFileBytesSent;
-
-    TBool iProgress;
-    TInt iNotifiedBytes;
-    TInt iPendingBytes;
+        /// file for incoming data, owned
+        RFile* iTempFile;
+        
+        // number of bytes currently transmitted or received
+        TInt iCurrentNumberOfBytes;
+        
+        // current message chunk status
+        TMsrpMsgEndStatus iMessageEnding;
     };
 
 #endif /* CMSRPMESSAGEHANDLER_H_ */
--- a/Msrp/MsrpServer/inc/CMSRPMsgParser.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPMsgParser.h	Thu Nov 25 13:59:42 2010 +0200
@@ -40,58 +40,72 @@
 class CMSRPMsgParser: public CBase
     {
     friend class CMSRPParser;    
-public:
-    enum TParseState 
-        {
-        EIdle = 0,
-        ETitleLine,
-        EToPath,
-        EFromPath,
-        //EMandatoryHeader,
-        EOptionalHeaders,
-        EBody,
-        EExtraCRLF,        
-        EEndofEndLine
-        };
+    public:
+        enum TParseState 
+            {
+            EIdle = 0,
+            ETitleLine,
+            EToPath,
+            EFromPath,
+            //EMandatoryHeader,
+            EOptionalHeaders,
+            EBody,
+            EExtraCRLF,        
+            EEndofEndLine
+            };
+            
+        enum TMatchType
+            {
+            ENoMatch,
+            EFullMatch,        
+            EPartialMatch   
+            };
         
-    enum TMatchType
-        {
-        ENoMatch,
-        EFullMatch,        
-        EPartialMatch   
-        };
-    
-    static CMSRPMsgParser* NewL(MMSRPParserObserver& aConnection);
-    virtual ~CMSRPMsgParser();
+        static CMSRPMsgParser* NewL(MMSRPParserObserver& aConnection);
+        virtual ~CMSRPMsgParser();
+        
+        TBool ParseL();
     
-    TBool ParseL();
-
-private:
-    CMSRPMsgParser(MMSRPParserObserver& aConnection);
-    void ConstructL();
-    
-    TBool HandleFullMatchL(TPtrC8& aToken, TInt aMatchPos, TBool aCopyToLocal = FALSE);
-    TBool HandlePartialMatchL(TPtrC8& aToken, TInt aCurBufMatchPos);
-    TBool HandleNoMatchL(TPtrC8& aToken, TInt aCurBufMatchPos);
+    private:
+        CMSRPMsgParser(MMSRPParserObserver& aConnection);
+        void ConstructL();
+        
+        TBool HandleFullMatchL(TPtrC8& aToken, TInt aMatchPos, TBool aCopyToLocal = FALSE);
+        TBool HandlePartialMatchL(TPtrC8& aToken, TInt aCurBufMatchPos);
+        TBool HandleNoMatchL(TPtrC8& aToken, TInt aCurBufMatchPos);
+        
+        void HandleStateL(const TDesC8& aString, TInt aMatchPos);
+        void HandleTitleLineL(const TDesC8& aString, TInt aMatchPos);
+        void HandleHeaderL(const TDesC8& aString, TInt aMatchPos);
+        void HandleOptionalHeaderL(const TDesC8& aString, TInt aMatchPos);
+        void HandleBodyL(const TDesC8& aString, TInt aMatchPos);
+        void HandleXtraCrlfL(const TDesC8& aString, TInt aMatchPos);
+        void HandleEndofEndLineL(const TDesC8& aString, TInt aMatchPos);
+            
+        TMatchType FindToken(const TDesC8& aString, const TDesC8& aToken, TInt& aMatchPos);
+        
+        /**
+        * Check if this chunk belongs to one of messages received 
+        * earlier. If so, the messages are combined to one
+        * entity
+        */
+        void CheckMessageChunkL( );
     
-    void HandleStateL(const TDesC8& aString, TInt aMatchPos);
-    void HandleTitleLineL(const TDesC8& aString, TInt aMatchPos);
-    void HandleHeaderL(const TDesC8& aString, TInt aMatchPos);
-    void HandleOptionalHeaderL(const TDesC8& aString, TInt aMatchPos);
-    void HandleBodyL(const TDesC8& aString, TInt aMatchPos);
-    void HandleXtraCrlfL(const TDesC8& aString, TInt aMatchPos);
-    void HandleEndofEndLineL(const TDesC8& aString, TInt aMatchPos);
-        
-    TMatchType FindToken(const TDesC8& aString, const TDesC8& aToken, TInt& aMatchPos);
+    private:
+    
+        MMSRPParserObserver& iConnection;
+        RPointerArray<RMsrpBuf> iParseBuffers;
+        TParseState iState;
+        RMsrpBuf* iLocalBuf;//keep it above pool
+        CMSRPMessageHandler* iMessage;
+        CMSRPBufPool iBufPool;
+        HBufC8* iEndToken;
         
-
-private:
-    MMSRPParserObserver& iConnection;
-    RPointerArray<RMsrpBuf> iParseBuffers;
-    TParseState iState;
-    RMsrpBuf* iLocalBuf;//keep it above pool
-    CMSRPMessageHandler* iMessage;
-    CMSRPBufPool iBufPool;
-    HBufC8* iEndToken;
+        // byte-range header included indicator
+        TBool iByteRangeHeaderFound;
+        
+        // pool of incoming message chunks. This array contains unfinished 
+        // message chunks which are waiting for the next chunk to arrive
+        RPointerArray< CMSRPMessageHandler > iIncomingMessageChunks;
     };
 #endif /* CMSRPMSGPARSER_H_ */
--- a/Msrp/MsrpServer/inc/CMSRPServerSubSession.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPServerSubSession.h	Thu Nov 25 13:59:42 2010 +0200
@@ -76,6 +76,8 @@
 		inline TBool Queue(T& element);
 		inline T* DeQueue();
 		inline TBool isEmpty();
+        inline T* FindElement( T* aMatch );
+        inline T* FindElement( TDesC8& aMessageId );
 
 		inline T* getHead();
 		
@@ -145,6 +147,50 @@
 	}
 
 template <class T>
+T* CQueue<T>::FindElement( T* aMatch )
+    {
+    if( !iList.IsEmpty() )
+        {
+        TSglQueIter<T> iterator(CQueue<T>::iList);
+        iterator.SetToFirst();
+        T* matchingOwner;
+        
+        while( ( matchingOwner = iterator++ ) )
+            {
+            if( matchingOwner == aMatch )
+                {
+                return matchingOwner;
+                }
+            }
+        }
+    return NULL;
+    }
+
+template <class T>
+T* CQueue<T>::FindElement( TDesC8& aMessageId )
+    {
+    if( !iList.IsEmpty() )
+        {
+        TSglQueIter<T> iterator(CQueue<T>::iList);
+        iterator.SetToFirst();
+        T* currentElement;
+        
+        while( ( currentElement = iterator++ ) )
+            {
+            HBufC8* messageId = currentElement->MessageIdLC();
+            if ( *messageId == aMessageId )
+                {
+                CleanupStack::PopAndDestroy( ); // messageId
+                return currentElement;
+                }
+            CleanupStack::PopAndDestroy( ); // messageId
+            }
+        }
+        
+    return NULL;
+    }
+
+template <class T>
 T* CQueue<T>::getMatch(T* aMatch)	
 	{
 		aMatch;
@@ -194,10 +240,13 @@
 		
 		while((iMatchingOwner = iterator++))
 			{
-			if(iMatchingOwner->IsOwnerOfResponse(*aInCommingMsg))
-				{
-				return iMatchingOwner;
-				}
+			if ( iMatchingOwner != aInCommingMsg )
+			    {
+                if(iMatchingOwner->IsOwnerOfResponse(*aInCommingMsg))
+                    {
+                    return iMatchingOwner;
+                    }
+                }
 			}
 
 		return NULL;
@@ -219,16 +268,22 @@
 	enum TQueueType
 		{
 		TClientQueue,
-		TInCommingMsgQueue	
+		TInCommingMsgQueue,
+		TCompletedSendQueue,
+        TCompletedIncQueue,
+		TReceiveProgressQueue,
+		TSendProgressQueue
 		};
 	
-    static CMSRPServerSubSession* NewL( CMSRPServerSession& aServerSession, CStateFactory& aStateFactory );
+    static CMSRPServerSubSession* NewL( 
+            CMSRPServerSession& aServerSession, CStateFactory& aStateFactory, const TDesC8& aSessionId );
     
-    static CMSRPServerSubSession* NewLC( CMSRPServerSession& aServerSession, CStateFactory& aStateFactory );
+    static CMSRPServerSubSession* NewLC( 
+            CMSRPServerSession& aServerSession, CStateFactory& aStateFactory, const TDesC8& aSessionId );
        
     virtual ~CMSRPServerSubSession( );
        
-    TBool ServiceL( const RMessage2& aMessage );
+    void ServiceL( const RMessage2& aMessage );
 
 	// From MMSRPConnectionObserver
 	void ConnectionStateL( TInt aNewState, TInt aStatus );
@@ -238,35 +293,33 @@
 	void UnclaimedMessageL( CMSRPMessageHandler* aMsg );
 
 	// From MMSRPMsgObserver
-	void MessageSendCompleteL();
+	void MessageSendCompleteL( CMSRPMessageHandler* aMessageHandler );
 	
 	void MessageResponseSendCompleteL(CMSRPMessageHandler& aMsg);
 	
-	virtual void MessageSendProgressL(TInt aBytesSent, TInt aTotalBytes);
+    void MessageReportSendCompleteL( CMSRPMessageHandler& aMsg );
+	
+	void MessageSendProgressL( CMSRPMessageHandler* aMessageHandler );
 	
-	virtual void MessageReceiveProgressL(TInt aBytesSent, TInt aTotalBytes);
+	void MessageReceiveProgressL( CMSRPMessageHandler* aMessageHandler );
+	
+	void MessageCancelledL( );
 		
 	void WriterError();
-     
-	CMSRPMessageHandler* ReceiveFileMsgHandler();
-	
-	void NotifyFileReceiveResultToClientL(CMSRPMessageHandler *msgHandler);
-	
-	void NotifyFileSendResultToClientL(CMSRPMessageHandler *msgHandler);
 	
 private:
     CMSRPServerSession& iServerSession;
     CMSRPServerSubSession( CMSRPServerSession& aServerSession, CStateFactory &aStateFactory);
-    void ConstructL();
+    void ConstructL( const TDesC8& aSessionId );
 
 	// ProcessEventL shall only take a event. The data associated with the event can be a 
 	// RMessage(Client to Server events), CSendBuffer(buffer being send out by connection manager), 
 	// CMSRPMessage(received message) or other such data.
 	// The associated data is stored in the context and retrieved by the relevant state when needed.
 	
-	TBool CMSRPServerSubSession::ProcessEventL( TMSRPFSMEvent aEvent);
+	void CMSRPServerSubSession::ProcessEventL( TMSRPFSMEvent aEvent);
         
-    HBufC8* CreateSubSessionIDL( );
+	//HBufC8* CreateSubSessionIDL( );
     
     void HandleLocalPathRequestL( const RMessage2& aMessage );
        
@@ -296,10 +349,11 @@
 
 	// Utility functions.
 
-	TBool sendResultToClientL(CMSRPMessageHandler *incommingMsgHandler);
+	void sendResultToClientL(CMSRPMessageHandler *incommingMsgHandler);
 	TBool sendMsgToClientL(CMSRPMessageHandler *incommingMsgHandler);
-	TBool SendProgressToClientL(CMSRPMessageHandler *msgHandler);
-	TBool ReceiveProgressToClientL(CMSRPMessageHandler *msgHandler);
+    TBool sendReportToClientL( CMSRPMessageHandler *incommingMsgHandler );
+	void SendProgressToClientL( CMSRPMessageHandler* aMessageHandler );
+	void ReceiveProgressToClientL( CMSRPMessageHandler* aMessageHandler );
 
 	void ReadSendDataPckgL();
 
@@ -312,7 +366,13 @@
 
 	void QueueLog();
 
-	TBool checkMessageForSelfL(CMSRPMessageHandler *aMsgHandler);
+    /**
+    * Checks that incoming messages session id is a correct one for
+    * this session
+    * @param aMsgHandler message handler containing the incoming message
+    * @return true if message belongs to this session, false if not
+    */
+    TBool CheckMessageSessionIdL( CMSRPMessageHandler *aMsgHandler );
 	TBool matchSessionIDL(const CMSRPHeaderBase *aPathHeader, TBool local = TRUE);
 	TPtrC8 extractSessionID(const TDesC8& aPathBuffer);
 
@@ -351,12 +411,17 @@
 	const RMessage2* iClientMessage;
 	CMSRPMessageHandler* iReceivedMsg;
 	CMSRPMessageHandler* iReceivedResp;
+    CMSRPMessageHandler* iReceivedReport;
 	CMSRPMessageHandler* iReceiveFileMsgHdler;
-	TBool iFileShare; //is previous state file share
 	TBool iSendCompleteNotify; //
 	TBool iReceiveCompleteNotify;
-	TInt iBytesTransferred;
-	TInt iTotalBytes;
+	TBool iFileShareCancelled;
+	
+	// used for progress reports, temporary, not owned
+    CMSRPMessageHandler* iReceiveProgressMsg;
+    
+    // used for progress reports, temporary, not owned
+    CMSRPMessageHandler* iSendProgressMsg;
 	
 	// Client Listners waiting to be completed.
 	
@@ -377,19 +442,28 @@
 	// OutGoingMessage queue where it waits for a response to arrive.
 	CMSRPMessageHandler *iCurrentMsgHandler;	
 
-	// Queues.	
+	// Message queues	
 	CQueueMsgHandlers<CMSRPMessageHandler> iOutMsgQ;
 	CQueueMsgHandlers<CMSRPMessageHandler> iInCommingMsgQ;
 	CQueueMsgHandlers<CMSRPMessageHandler> iPendingSendMsgQ;
-	CQueueMsgHandlers<CMSRPMessageHandler> iPendingForDeletionQ;		
-
+	CQueueMsgHandlers<CMSRPMessageHandler> iPendingForDeletionQ;	
+    CQueueMsgHandlers< CMSRPMessageHandler > iPendingDataSendCompleteQ;    
+    CQueueMsgHandlers< CMSRPMessageHandler > iPendingDataIncCompleteQ;    
+    
+    // progress report queues
+    CQueueMsgHandlers< CMSRPMessageHandler > iPendingSendProgressQ;    
+    CQueueMsgHandlers< CMSRPMessageHandler > iPendingReceiveProgressQ;    
+	
+	// This queue holds the instance of messages currently being received
+    CQueueMsgHandlers< CMSRPMessageHandler > iCurrentlyReceivingMsgQ;    
+	
+	TBool iSendProgressReports;
+	
 	friend class TStateBase;
 	friend class TStateIdle; 
 	friend class TStateConnecting; 
 	friend class TStateActive;
-	friend class TStateActiveSend;
 	friend class TStateWaitForClient; 
-	friend class TStateFileShare;
 	friend class TStateError; // Not a very good thing !! Need change.
 
 	#ifdef __UT_TSTATEFACTORY_H__
--- a/Msrp/MsrpServer/inc/CMSRPWriter.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/CMSRPWriter.h	Thu Nov 25 13:59:42 2010 +0200
@@ -34,29 +34,31 @@
 
 class CMSRPWriter : public CActive, public MMSRPWriter
     {
- public:
+     public:
+    
+         // Constructors and destructor
+         static MMSRPWriter* NewL(RSocket& aSocket, MMSRPWriterErrorObserver& aConnection );
+         virtual ~CMSRPWriter();
 
-     // Constructors and destructor
-     static MMSRPWriter* NewL(RSocket& aSocket, MMSRPWriterErrorObserver& aConnection );
-     virtual ~CMSRPWriter();
-      
-     virtual void RequestSendL(MMSRPWriterObserver& aMsg);
-     
- protected: // from CActive
-     void DoCancel();
-     void RunL();
-     TInt RunError(TInt aError);
+     public: // from MMSRPWriter
+         void RequestSendL(MMSRPWriterObserver& aMsg);
+         void CancelSendingL( const MMSRPWriterObserver* aMsg );
+         
+     protected: // from CActive
+         void DoCancel();
+         void RunL();
+         TInt RunError(TInt aError);
+        
+     private:
+         CMSRPWriter(RSocket& aSocket, MMSRPWriterErrorObserver& aConnection);
+         void ConstructL();
+         void SendL();
     
- private:
-     CMSRPWriter(RSocket& aSocket, MMSRPWriterErrorObserver& aConnection);
-     void ConstructL();
-     void SendL();
-
- private: // data
-     MMSRPWriterErrorObserver& iConnection;  
-     RSocket& iSocket;     
-     RPointerArray<MMSRPWriterObserver> iSendQueue;
-     TBool iWriteIssued;
+     private: // data
+         MMSRPWriterErrorObserver& iConnection;  
+         RSocket& iSocket;     
+         RPointerArray<MMSRPWriterObserver> iSendQueue;
+         TBool iWriteIssued;
     };     
 
 #endif // CMSRPWRITER_H
--- a/Msrp/MsrpServer/inc/MMSRPConnection.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPConnection.h	Thu Nov 25 13:59:42 2010 +0200
@@ -94,11 +94,25 @@
     * Sends the buffer content
     * the observer cud be implemented by msg or subsession
     * connection observer deemed unnecessary in send call
+    * @param aMsg message writer observer class
     */
     virtual void SendL( MMSRPWriterObserver& aMsg ) = 0;
             
+    /**
+    * Continue sending the current message. This usually is called when
+    * new chunk of message is to be transmitted after receiving a response
+    * to chunk
+    * @param aMsg message writer observer class
+    */
+    virtual void ContinueSendingL( MMSRPWriterObserver& aMsg ) = 0;
     
     /**
+    * Cancels the sending if given message is currently being sent
+    * @param aMsg message writer observer class
+    */
+    virtual void CancelSendingL( const MMSRPWriterObserver* aMsg ) = 0;
+
+    /**
      * use case unknown : connection failure detected, parse error on the connection
      * Send failed , goes directly to subsession.
      * In that scenario, subession could ask mngr to close connection itself as part of error recovery
@@ -120,7 +134,7 @@
     //virtual MMSRPConnection* NewL( TInetAddr& aRemoteAddr, MMSRPConnectionManager& aConnMngr) = 0;
     
     /**
-     * called on listen complete by connection manager
+     * called on listen complete by connection manager
      */
     virtual void ConnectionEstablishedL( TInt aNewState, RSocket* aSocket, TInt aStatus ) = 0;
     
--- a/Msrp/MsrpServer/inc/MMSRPConnectionManager.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPConnectionManager.h	Thu Nov 25 13:59:42 2010 +0200
@@ -80,6 +80,12 @@
 	            
 	    virtual RConnection& SocketServerConn() = 0 ;
 	    
+        /**
+         * Try to restart the inferface in case error is encountered 
+         */
+        virtual TInt ReStartInterface() = 0;
+	    
+	    
 	    //virtual TBool MatchIapId(TUint32 aIapID);
 	    
 	};
--- a/Msrp/MsrpServer/inc/MMSRPConnectionObserver.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPConnectionObserver.h	Thu Nov 25 13:59:42 2010 +0200
@@ -51,8 +51,17 @@
          */
         virtual TBool MessageReceivedL( CMSRPMessageHandler* aMsg ) = 0;
         
+        /**
+         * Message received which does not belong to any existing session
+         * @param aMsg the received message
+         */
         virtual void UnclaimedMessageL( CMSRPMessageHandler* aMsg ) = 0;
-
+        
+        /**
+        * Current message receive progress reported to connected subsessions
+        * @param aMessageHandler message handler instance, ownership not transferred
+         */
+        virtual void MessageReceiveProgressL( CMSRPMessageHandler* aMessageHandler ) = 0;
     };
 
 #endif // MMMSRPCONNECTIONOBSERVER_H
--- a/Msrp/MsrpServer/inc/MMSRPIncomingMessage.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPIncomingMessage.h	Thu Nov 25 13:59:42 2010 +0200
@@ -24,6 +24,7 @@
 class MMSRPMessageObserver;
 class CMSRPMessage;
 class CMSRPResponse;
+class CMSRPReport;
 class MMSRPConnection;
 
 
@@ -46,16 +47,38 @@
         
     virtual TMSRPMessageType MessageType( ) = 0;
     
-    virtual CMSRPMessage* GetIncomingMessage( ) = 0;
+    /**
+    * Returns the message instance belogning to this class 
+    * @return MSRP message owned by this class, ownership is not transferred!
+    */
+    virtual CMSRPMessage* GetIncomingMessage( ) const = 0;
     
-	virtual TBool SendResponseL( MMSRPMessageObserver* aMessageObserver, 
+	virtual void SendResponseL( MMSRPMessageObserver* aMessageObserver, 
 												MMSRPConnection& aConnection, TUint aResponseCode )=0;
 
-    
+    /**
+    * Sends a report request to client 
+    * @param aMessageObserver incoming message observer entity
+    * @param aConnection connection instance
+    * @param aStatusCode status code for the response
+    * @return true if report was sent
+    */
+    virtual TBool SendReportL( MMSRPMessageObserver* aMessageObserver, 
+                                    MMSRPConnection& aConnection, TUint aStatusCode ) = 0;
+  
     virtual TDesC8& TransactionId( ) = 0;
     
-    virtual CMSRPResponse* GetIncomingResponse( ) = 0;
-        
+    /**
+    * Returns the response instance belogning to this class 
+    * @return MSRP response owned by this class, ownership is not transferred!
+    */
+    virtual CMSRPResponse* GetIncomingResponse( ) const = 0;
+
+    /**
+    * Returns the report instance belogning to this class 
+    * @return MSRP response owned by this class, ownership is not transferred!
+    */
+    virtual CMSRPReport* GetIncomingReport( ) const = 0;
     };
 
 #endif /* MMSRPINCOMINGMESSAGE_H_ */
--- a/Msrp/MsrpServer/inc/MMSRPMessageHandler.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPMessageHandler.h	Thu Nov 25 13:59:42 2010 +0200
@@ -19,11 +19,14 @@
 
 // INCLUDES
 
+// forwrd declarations
+class CMSRPMessageHandler;
+
 
 // CLASS DECLARATIONS
 
 /* MSRP Message request interface
- * 
+ * 
  */
 class MMSRPMessageHandler
     {
@@ -45,6 +48,7 @@
     
     enum TMsrpMsgEndStatus
         {
+        EMessageNotDefined,
         EMessageEnd, // $
         EMessageContinues, // +
         EMessageTerminated // #
@@ -54,14 +58,21 @@
    
     virtual void AddHeaderL( TMsrpHeaderType aHeaderType, TPtrC8& aHeaderValue, TPtrC8& aHeaderTypeAndValue ) = 0;
     
-    virtual void AddContentL( TPtrC8& aContent ) = 0;
+    virtual void AddContentL( TPtrC8& aContent, TBool aByteRangeFound = EFalse ) = 0;
     
-    virtual void SetTransactionId( TPtrC8& aTransactionId ) = 0;
+    virtual void SetTransactionId( TDesC8& aTransactionId ) = 0;
     
     virtual void SetStatusOfResponseL( TPtrC8& aStatusCode, TPtrC8& aStatusMessage ) = 0;
     
     virtual void EndOfMessageL( TMsrpMsgEndStatus aStatus ) = 0;
     
+    /**
+    * Check if this chunk belongs to one of messages received 
+    * earlier. If so, the messages are combined to one
+    * entity
+    * @return true if given message belongs to already received chunk
+    */
+    virtual TBool CheckMessageChunkL( CMSRPMessageHandler& aOtherMessage ) = 0;
     };
 
 #endif /* MMSRPMESSAGEHANDLER_H_ */
--- a/Msrp/MsrpServer/inc/MMSRPMessageObserver.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPMessageObserver.h	Thu Nov 25 13:59:42 2010 +0200
@@ -28,13 +28,37 @@
 
 public:
     
-    virtual void MessageSendCompleteL( ) = 0;
+    /**
+    * Informs when the whole message has been sent successfully
+    * @param aMessageHandler message handler instance, ownership not transferred
+     */
+    virtual void MessageSendCompleteL( CMSRPMessageHandler* aMessageHandler ) = 0;
     
+    /**
+    * Informs when response has been sent to the incoming message
+    * @param aMessageHandler message handler instance, ownership not transferred
+     */
 	virtual void MessageResponseSendCompleteL( CMSRPMessageHandler& aMsg ) = 0;
+
+    /**
+    * Informs when report has been sent to the incoming message
+    * @param aMessageHandler message handler instance, ownership not transferred
+     */
+    virtual void MessageReportSendCompleteL( CMSRPMessageHandler& aMsg ) = 0;
+
+    /**
+    * Current message send progress reported to connected subsessions
+    * @param aMessageHandler message handler instance, ownership not transferred
+     */
+	virtual void MessageSendProgressL( CMSRPMessageHandler* aMessageHandler ) = 0;
 	
-	virtual void MessageSendProgressL(TInt aBytesSent, TInt aTotalBytes) = 0;
+    /**
+    * Current message receive progress reported to connected subsessions
+    * @param aMessageHandler message handler instance, ownership not transferred
+     */
+	virtual void MessageReceiveProgressL( CMSRPMessageHandler* aMessageHandler ) = 0;
 	
-	virtual void MessageReceiveProgressL(TInt aBytesSent, TInt aTotalBytes) = 0;
+	virtual void MessageCancelledL( ) = 0;
         
     virtual void WriterError( ) = 0;
     
--- a/Msrp/MsrpServer/inc/MMSRPOutgoingMessage.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPOutgoingMessage.h	Thu Nov 25 13:59:42 2010 +0200
@@ -37,11 +37,21 @@
     
     virtual TBool IsOwnerOfResponse( MMSRPIncomingMessage& aIncomingMessage ) = 0;
     
-    virtual TBool ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage ) = 0;
+    virtual TUint ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage ) = 0;
     
     virtual TBool IsMessageComplete() = 0;
     
-    virtual TBool GetSendResultL( TUint &aErrorCode, HBufC8* &aMessageId ) = 0;
+    /**
+    * Returns the responses error code
+    * @param aMessageId Buffer for message id, allocates buffer, ownership is transferred
+    * @return response error code, defined in TMSRPErrorCodes
+    */
+    virtual TUint GetSendResultL( HBufC8* &aMessageId ) = 0;
     
+    /**
+    * Used to check whether the Failure-Report header is set as "partial"
+    * @return true if failure-report header is set to partial
+    */
+    virtual TBool IsFailureHeaderPartial() = 0; 
     };
 #endif /* MMSRPOUTGOINGMESSAGE_H_ */
--- a/Msrp/MsrpServer/inc/MMSRPParserObserver.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPParserObserver.h	Thu Nov 25 13:59:42 2010 +0200
@@ -35,18 +35,35 @@
 */
 class MMSRPParserObserver
 	{
+	public: // enums
+        /** Error codes returned to the client */
+        enum TParseStatusResponses
+            {
+            EParseStatusNotDefined,
+            EParseStatusError,
+            EParseStatusMessageUnclaimed,
+            EParseStatusMessageHandled
+            };
+	
 	public:
 
 	    /**
 	     * Message, Report, Response
-	     * MessageReceived
-	     * @return true if consumed 
+	     * @param aMsg received message
+	     * @param aStatus message status
+	     * @return TParseStatusResponses 
 	     */
-        virtual void ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus) = 0;
+        virtual TInt ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus) = 0;
+	    
+        /**
+         * Report currently received bytes 
+         * @param aMsg message handler instance 
+         */
+        virtual void ReportReceiveprogressL( CMSRPMessageHandler* aMsg ) = 0; 
 	    
 	    /**
 	     * Parse error: Handle similar to connection error now
-	     * Try to recover from parse errors, using byte-range etc. later 
+	     * Try to recover from parse errors, using byte-range etc. later 
 	     */
 	    //virtual void ParseResult (TInt aStatus, CMessage* aMsg) = 0;
         //virtual void ParseError () = 0;
@@ -55,7 +72,7 @@
 	     * Part of large chunk
 	     * Same as message received, msg internal state incomplete
 	     * msg co-owned by parser and subsession, parsing continues after transfer to msrp session
-	     * the content ptrs can be completed and closed (Removing them from msg' content_ptrs_list) and thus freeing content buffers for reuse if needed
+	     * the content ptrs can be completed and closed (Removing them from msg' content_ptrs_list) and thus freeing content buffers for reuse if needed
 	     */
 	    
 	};
--- a/Msrp/MsrpServer/inc/MMSRPWriter.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPWriter.h	Thu Nov 25 13:59:42 2010 +0200
@@ -28,26 +28,37 @@
 class MMSRPWriter
 	{
 	public:
-	    inline virtual ~MMSRPWriter(){}
+
+        /**
+         * Virtual destructor
+         */     
+        inline virtual ~MMSRPWriter(){}
+	    
 	    /**
 	     * register for send service
-	     * also triggers writer start, inactive on nothing to send
+	     * also triggers writer start, inactive on nothing to send
 	     */	    
 	    virtual void RequestSendL(MMSRPWriterObserver& aMsg) = 0;
 
         /**
+         * Cancels the sending if given message is currently being sent
+         * @param aMsg message writer observer class
+         */     
+        virtual void CancelSendingL( const MMSRPWriterObserver* aMsg ) = 0;
+
+        /**
          * Cancel current send, socket state to be verified
          */
         //virtual void CancelWrite() = 0; //not supported, only cancel message supported, i.e. chunk abort
         
         /**
-         * Stops the writer from sending data
+         * Stops the writer from sending data
          */
         //virtual void Stop() = 0;
         //virtual void Start() = 0;
         
         /**
-         * Stops sending and discards all pending data
+         * Stops sending and discards all pending data
          */
         //virtual void Flush() = 0;                
         
--- a/Msrp/MsrpServer/inc/MMSRPWriterObserver.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MMSRPWriterObserver.h	Thu Nov 25 13:59:42 2010 +0200
@@ -36,7 +36,9 @@
         EUndefined = 0,
 	    EPending, //Sending incomplete. Same observer is called again immediately
 	    EComplete, //No more to send. A new observer is called, this is removed 
-	    EInterrupted //There is more to send. Same observer called later
+	    EInterrupted, //There is more to send. Same observer called later
+	    EWaitingForResponse,
+	    ESendingReport // sending report when requested
 	    };	
 	
 	    /**
@@ -45,7 +47,7 @@
 	     * @param aInterrupt Signals whether other msgs are queued waiting to be sent
 	     * @return KErrNone or system wide eror codes 
 	     */	    
-	    virtual TWriteStatus GetSendBufferL( TPtrC8& aData, TBool aInterrupt ) = 0;
+	    virtual const TDesC8& GetSendBufferL( TWriteStatus& aStatus, TBool aInterrupt ) = 0;
 
 	   /**           
         * Called when the message has been written to the socket
--- a/Msrp/MsrpServer/inc/MSRPServerCommon.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/MSRPServerCommon.h	Thu Nov 25 13:59:42 2010 +0200
@@ -71,26 +71,27 @@
 	EMSRPListenMessagesEvent,  // 3
 	EMSRPListenSendResultEvent,  // 4 Client Setup event to setup listner for incomming results.
 	EMSRPDataSendMessageEvent,	// 5 Client Event to send data.	
-	EMSRPSendFileEvent,         // 6
-	EMSRPReceiveFileEvent,      // 7
-	EMSRPDataSendMessageCancelEvent, // 8
+	EMSRPDataSendMessageCancelEvent, // 6
 
 	// Should be CancelClientSetup1, 2 and 3 respectively.
-	EMSRPCancelReceivingEvent, 			// 9  Maps to EMSRPCancelReceiving. What is EMSRPCancelReceiving for? !!
-	EMSRPCancelSendRespListeningEvent,  // 10  Maps to EMSRPCancelSendRespListening. What is EMSRPCancelSendRespListening for? !!
+	EMSRPCancelReceivingEvent, 			// 7  Maps to EMSRPCancelReceiving. What is EMSRPCancelReceiving for? !!
+	EMSRPCancelSendRespListeningEvent,  // 8 Maps to EMSRPCancelSendRespListening. What is EMSRPCancelSendRespListening for? !!
+	
+	EMSRPProcessQueuedRequestsEvent,    // 9
+	EMSRPProgressReportsEvent,          // 10
 	
 	// Events generated from the Message Layer.
-	EMSRPDataSendCompleteEvent,         // 11  
+	EMSRPDataSendCompleteEvent,         // 11
 	EMSRPResponseSendCompleteEvent,		// 12
-          
+	EMSRPSendProgressEvent,             // 13
+    EMSRPReceiveProgressEvent,          // 14
+	EMSRPDataCancelledEvent,            // 15
 	
 	// From Connection Layer
-	EMSRPIncomingMessageReceivedEvent, // 13
-	EConnectionStateChangedEvent,	   // 14
-	EUncalimedMessageReceivedEvent,     // 15
-	
-    EMSRPSendProgressEvent,
-    EMSRPReceiveProgressEvent
+	EMSRPIncomingMessageReceivedEvent, // 16
+	EConnectionStateChangedEvent,	   // 17
+	EUncalimedMessageReceivedEvent,    // 18
+    EMSRPReportSendCompleteEvent,     // 19
 };
 #endif      // __MSRPSERVERCOMMON_H
 
--- a/Msrp/MsrpServer/inc/TStates.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/inc/TStates.h	Thu Nov 25 13:59:42 2010 +0200
@@ -25,14 +25,11 @@
 
 enum TStates
 {
-    EIdle = 0,
+    EIdle,
     EConnecting,    
     EWaitForClient,    
     EActive,
-    EActiveSend,
-    EFileShare,
-	EError,
-    EEndLine
+	EError
 };
 
 
@@ -43,6 +40,10 @@
     virtual TStateBase* HandleStateErrorL(CMSRPServerSubSession *aContext);
     virtual TStateBase * processIncommingMessageL(CMSRPServerSubSession *aContext, CMSRPMessageHandler* incommingMsg = NULL);
     TStateBase * processPendingMessageQL( CMSRPServerSubSession *aContext );
+    TStateBase * processCompletedMessageL( CMSRPServerSubSession *aContext );
+    TStateBase * processCompletedIncomingMessageL( CMSRPServerSubSession *aContext );
+    TStateBase * processReceiveReportL( CMSRPServerSubSession *aContext );
+    TStateBase * processSendReportL( CMSRPServerSubSession *aContext );
     virtual TStateBase * handlesResponseL(CMSRPServerSubSession *aContext,
                     CMSRPMessageHandler *incommingMsgHandler);
 
@@ -51,13 +52,14 @@
     
     TStateBase* handleClientListnerCancelL(CMSRPServerSubSession * aContext, 
                                         TMSRPFSMEvent aEvent);
+    TStateBase* HandleClientCancelSendingL(CMSRPServerSubSession * aContext ); 
     TStateBase* handleConnectionStateChangedL(CMSRPServerSubSession *aContext);
     TStateBase* handleQueuesL(CMSRPServerSubSession *aContext);
 	TStateBase* handleConnectionErrorsL(CMSRPServerSubSession *aContext);
     virtual TStates identity()=0;
     TStateBase* handleInCommingMessagesL(CMSRPServerSubSession *aContext);
-    TStateBase* handleSendFileL(CMSRPServerSubSession *aContext);
-    TStateBase* handleReceiveFileL(CMSRPServerSubSession *aContext);
+    TStateBase* handleCancelFileSendingL(CMSRPServerSubSession *aContext);
+    TStateBase* MessageSendCompleteL(CMSRPServerSubSession *aContext); 
 };
 
 
@@ -91,11 +93,6 @@
 public:
     TStateBase* EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext);
     TStates identity();
-    
-private:
-    TStateBase* fileSendCompleteL(CMSRPServerSubSession *aContext);
-    TStateBase * handleResponseSentL( CMSRPServerSubSession *aContext);
-    
 };
 
 
@@ -106,47 +103,11 @@
     TStates identity();
 
 private:
-    TStateBase* handleSendDataL(CMSRPServerSubSession *aContext);
-    
+    TStateBase* handleSendDataL( CMSRPServerSubSession* aContext );
+    TStateBase* handleResponseSentL( CMSRPServerSubSession* aContext);
+    TStateBase* handleReportSentL( CMSRPServerSubSession* aContext);
 };
 
-
-class TStateFileShare : public TStateBase
-{
-public:
-    TStateBase* EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext);
-    TStates identity();
-
-private:
-    TStateBase * processIncommingMessageL(CMSRPServerSubSession *aContext, CMSRPMessageHandler* incommingMsg = NULL);
-    
-    TStateBase* fileSendCompleteL(CMSRPServerSubSession *aContext);
-    TStateBase * handlesResponseL(CMSRPServerSubSession *aContext,
-                          CMSRPMessageHandler *incommingMsgHandler);
-    
-    TStateBase* handleRequestsL(CMSRPServerSubSession *aContext,
-                    CMSRPMessageHandler *incommingMsgHandler);
-    TStateBase * handleResponseSentL( CMSRPServerSubSession *aContext);
-    
-    TStateBase * handleSendProgressL( CMSRPServerSubSession *aContext);
-    
-    TStateBase * handleReceiveProgressL( CMSRPServerSubSession *aContext);
-    
-};
-
-
-class TStateActiveSend : public TStateBase
-{
-public:
-    TStateBase* EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext);
-    TStates identity();
-    
-private:    
-    TStateBase * MessageSendCompleteL(CMSRPServerSubSession *aContext); 
-    
-};
-
-
 class TStateError : public TStateBase
 {
 public:
--- a/Msrp/MsrpServer/src/CMSRPConnection.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPConnection.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -321,14 +321,13 @@
     MSRPLOG("CMSRPConnection::ReadStatusL() exit")     
     }
 
-void CMSRPConnection::ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus)
+TInt CMSRPConnection::ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus)
     {
     MSRPLOG("CMSRPConnection::ParseStatus enter")
     if (aStatus != KErrNone)
         {
         NotifyAllL(EError, aStatus );
-        //CloseConnection();
-        return;
+        return MMSRPParserObserver::EParseStatusError;
         }
     
     /*if error, count is zero*/
@@ -336,16 +335,46 @@
     TBool consumed = FALSE;
     for ( TInt i = 0; (!consumed) && i < iSubsessions.Count(); i++ )
          {
-         consumed = iSubsessions[ i ]->MessageReceivedL( aMsg );
+         TRAPD( err, consumed = iSubsessions[ i ]->MessageReceivedL( aMsg ) );
+         if ( err )
+             {
+             // invalid message
+             NotifyAllL( EError, err );
+             return MMSRPParserObserver::EParseStatusError;
+             }
          }
     
     //if unclaimed by any subsession, callback to first subsession
     if(!consumed && iSubsessions.Count())
         {
         iSubsessions[0]->UnclaimedMessageL( aMsg );
+        return MMSRPParserObserver::EParseStatusMessageUnclaimed;
         }
           
     MSRPLOG("CMSRPConnection::ParseStatus exit")
+    return MMSRPParserObserver::EParseStatusMessageHandled;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPConnection::ReportReceiveprogressL
+// -----------------------------------------------------------------------------
+//
+void CMSRPConnection::ReportReceiveprogressL( CMSRPMessageHandler* aMsg )
+    {
+    MSRPLOG("-> CMSRPConnection::ReportReceiveprogressL")
+    
+    for ( TInt i = 0; i < iSubsessions.Count(); i++ )
+         {
+         TRAPD( err, iSubsessions[ i ]->MessageReceiveProgressL( aMsg ) );
+         if ( err )
+             {
+             // invalid message
+             NotifyAllL( EError, err );
+             return;
+             }
+         }
+          
+    MSRPLOG("<- CMSRPConnection::ReportReceiveprogressL")
     }
 
 // -----------------------------------------------------------------------------
@@ -372,6 +401,34 @@
         iWriter->RequestSendL(aMsg);
     MSRPLOG("CMSRPConnection::SendL() exit") 
     }
+    
+// -----------------------------------------------------------------------------
+// CMSRPConnection::ContinueSendingL
+// -----------------------------------------------------------------------------
+//
+void CMSRPConnection::ContinueSendingL( MMSRPWriterObserver& aMsg )
+    {
+    MSRPLOG("-> CMSRPConnection::ContinueSendingL")
+    if( iConnectionState == EConnected )
+        {
+        iWriter->RequestSendL( aMsg );
+        }
+    MSRPLOG("<- CMSRPConnection::ContinueSendingL") 
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPConnection::CancelSendingL
+// -----------------------------------------------------------------------------
+//
+void CMSRPConnection::CancelSendingL( const MMSRPWriterObserver* aMsg )
+    {
+    MSRPLOG("-> CMSRPConnection::CancelSendingL")
+    if( iConnectionState == EConnected )
+        {
+        iWriter->CancelSendingL( aMsg );
+        }
+    MSRPLOG("<- CMSRPConnection::CancelSendingL") 
+    }
 
 // -----------------------------------------------------------------------------
 // CMSRPConnection::TimerExpired
--- a/Msrp/MsrpServer/src/CMSRPConnectionManager.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPConnectionManager.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -19,7 +19,7 @@
 #include "MSRPCommon.h"
 #include "CMSRPConnection.h"
 #include "CMSRPConnListener.h"
-#include <CommDbConnPref.h>
+#undef __SERIES60_
 #if defined(__SERIES60_)
 #include <extendedconnpref.h>
 #endif
@@ -30,7 +30,7 @@
 // Constructor
 // -----------------------------------------------------------------------------
 //
-CMSRPConnectionManager::CMSRPConnectionManager( const TUint32 aIapID, MMSRPConnectionManagerObserver& aServer ) 
+CMSRPConnectionManager::CMSRPConnectionManager( const TUint32 aIapID, MMSRPConnectionManagerObserver& aServer )
                                                 : iIapID( aIapID ), iObserver( aServer )
     {
     MSRPLOG( "CMSRPConnectionManager::CMSRPConnectionManager enter" )
@@ -61,22 +61,22 @@
 //
 void CMSRPConnectionManager::ConstructL( )
 	{
-    MSRPLOG( "CMSRPConnectionManager::ConstructL enter" )    
+    MSRPLOG( "CMSRPConnectionManager::ConstructL enter" )
 
-	TInt status = iSocketServer.Connect();	
+	TInt status = iSocketServer.Connect();
 	if (status != KErrNone)
 	    {
 	    //iObserver->HandleError(ESocketServerStartFailed, status , *this );//need to pass connmngr as server handles many connmngrs
 	    //User::Leave(status);
 	    User::Leave(MMSRPConnectionManagerObserver::ESocketServerStartFailed); //leave code instead of observer call, as in constructl itself
 	    }
-	
-    status = StartInterface();    
+
+    status = StartInterface();
     if (status != KErrNone)
         {
         User::Leave(MMSRPConnectionManagerObserver::EInterfaceStartFailed);
         }
-    
+
     MSRPLOG( "CMSRPConnectionManager::ConstructL exit" )
 	}
 
@@ -84,14 +84,14 @@
 CMSRPConnectionManager::~CMSRPConnectionManager()
 	{
     MSRPLOG( "CMSRPConnectionManager::~CMSRPConnectionManager enter" )
-    
+
 	delete iConnListener;
 	iConnectionArray.ResetAndDestroy();
 	iConnectionArray.Close();
 	iHostResolver.Close();
 	iConnection.Close();
 	iSocketServer.Close();
-	
+
 	MSRPLOG( "CMSRPConnectionManager::~CMSRPConnectionManager exit" )
 	}
 
@@ -112,21 +112,21 @@
         User::Leave(MMSRPConnectionManagerObserver::EAddressResolveError);
         }
     hostAddr.SetPort(aPort);
-    
+
 	MMSRPConnection* connection = CheckConnection( hostAddr, FALSE );
-	
+
 	if ( !connection )
 		{
         connection = CMSRPConnection::NewL( hostAddr, *this );
         CleanupDeletePushL(connection);//as M class
         //CleanupStack::PushL( connection );
         iConnectionArray.AppendL( connection );
-        CleanupStack::Pop( );		        
+        CleanupStack::Pop( );
 		}
-			
+
     MSRPLOG( "CMSRPConnectionManager::getConnectionL exit" )
-    
-	return *connection;	
+
+	return *connection;
 	}
 
 
@@ -143,21 +143,21 @@
         {
         iConnListener = CMSRPConnListener::NewL(*this);
         }
-    
+
     TRAPD(err,iConnListener->ListenL());
 
     if(err != KErrNone)
         {
         //delete iConnListener;
-        //iConnListener = NULL;        
+        //iConnListener = NULL;
         //iObserver->HandleError( MMSRPConnectionManagerObserver::EListenerStartError, err , *this );//communicate to server to trigger cleanup
-        
+
         /*subsession can propagate to server (based on error), which handles error*/
         User::Leave(MMSRPConnectionManagerObserver::EListenerStartError); //listenL leaves to subsession
         }
-    
+
     MSRPLOG( "CMSRPConnectionManager::ListenL exit" )
-        
+
     }
 
 // -----------------------------------------------------------------------------
@@ -169,12 +169,12 @@
     {
     MSRPLOG( "CMSRPConnectionManager::ListenCancel enter" )
     if(iConnListener)
-        {                
-        iConnListener->ListenCancel();       
+        {
+        iConnListener->ListenCancel();
         }
     Remove(aConnection);
-    
-    MSRPLOG( "CMSRPConnectionManager::ListenCancel exit" )    
+
+    MSRPLOG( "CMSRPConnectionManager::ListenCancel exit" )
     }
 
 
@@ -186,24 +186,24 @@
     {
     MSRPLOG( "CMSRPConnectionManager::ListenerStateL enter" )
     if (aNewState == MMSRPListener::EListenAccepted)
-        {     
-        TInetAddr remoteAddr;        
+        {
+        TInetAddr remoteAddr;
         aDataSocket->RemoteName(remoteAddr);
-        
+
         MMSRPConnection* connection = CheckConnection( remoteAddr, TRUE );
-        
+
         if ( !connection )
             {
-            iConnListener->ListenCompletedL(FALSE);            
+            iConnListener->ListenCompletedL(FALSE);
             }
         else
             {
-            iConnListener->ListenCompletedL(TRUE);            
+            iConnListener->ListenCompletedL(TRUE);
             TRAPD(err, connection->ConnectionEstablishedL(MMSRPConnection::EConnected, aDataSocket, aStatus ));
             if(err!=KErrNone)
                 //non leaving on error, introduce separate fn later
                 connection->ConnectionEstablishedL(MMSRPConnection::EError, aDataSocket, err );
-            }                
+            }
         }
     else if (aNewState == MMSRPListener::ETimedOut || aNewState == MMSRPListener::ETerminate)
         {
@@ -216,7 +216,7 @@
         delete iConnListener;
         iConnListener = NULL;
         User::Leave(MMSRPConnectionManagerObserver::EListenPortFailed);
-        //leave here, propagate upto msrpscheduler, in scheduler error intimate server to handle the error 
+        //leave here, propagate upto msrpscheduler, in scheduler error intimate server to handle the error
         //instead could intimate observer (server) directly
         //iObserver->HandleError( MMSRPConnectionManagerObserver::EListenPortFailed, aStatus , *this );
         }
@@ -239,7 +239,7 @@
 			}
 		}
 	MSRPLOG( "CMSRPConnectionManager::CheckConnection exit" )
-	return NULL;	
+	return NULL;
 	}
 
 
@@ -250,9 +250,9 @@
 //
 TInt CMSRPConnectionManager::StartInterface()
     {
-    
+
     MSRPLOG( "CMSRPConnectionManager::StartInterface enter" )
-    
+
     TInt status = KErrNone;
     //if( !iConnection.SubSessionHandle() )
         {
@@ -264,7 +264,7 @@
     {
         TConnPrefList  prefList;
         TExtendedConnPref extPrefs;
-        
+
         extPrefs.SetIapId( iIapID );
         TRAP(status, prefList.AppendL(&extPrefs));
         if (status == KErrNone)
@@ -275,18 +275,34 @@
 #else
     if (status == KErrNone)
         {
-        TCommDbConnPref prefs;
-        prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
-        prefs.SetDirection( ECommDbConnectionDirectionUnknown );
-        prefs.SetIapId( iIapID );
-    
-        status = iConnection.Start( prefs );
-        }    
-#endif        
-               
+        iConnectionPreferences.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
+        iConnectionPreferences.SetDirection( ECommDbConnectionDirectionUnknown );
+        iConnectionPreferences.SetIapId( iIapID );
+
+        status = iConnection.Start( iConnectionPreferences );
+        }
+#endif
+
     MSRPLOG( "CMSRPConnectionManager::StartInterface exit" )
     return status;
-         
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPConnectionManager::ReStartInterface
+// -----------------------------------------------------------------------------
+//
+TInt CMSRPConnectionManager::ReStartInterface()
+    {
+    iConnection.Close();
+    iSocketServer.Close();
+    
+    TInt error = iSocketServer.Connect();
+    if ( !error )
+        {
+        error = StartInterface();
+        }
+    return error;
     }
 
 // -----------------------------------------------------------------------------
@@ -301,7 +317,7 @@
     //RHostResolver hostResolver;
     TNameEntry entry;
     TBuf< KMaxLengthOfUrl > hostAddr;
-    
+
     if( !iHostResolver.SubSessionHandle() )
         {
         User::LeaveIfError( iHostResolver.Open( iSocketServer, KAfInet,
@@ -309,7 +325,7 @@
         }
 
     //CleanupClosePushL( hostResolver );
-    
+
     hostAddr.Copy( aHost );
     User::LeaveIfError( iHostResolver.GetByName( hostAddr, entry ) );
     if ( !TInetAddr::Cast( entry().iAddr ).IsWildAddr() )
@@ -336,7 +352,7 @@
     /* Open an RSocket and find its address */
     RSocket socket;
     User::LeaveIfError(socket.Open(iSocketServer, KAfInet, KSockDatagram, KProtocolInetUdp,iConnection));
-    
+
     CleanupClosePushL(socket);
 
     TSoInetInterfaceInfo networkInfo;
@@ -345,7 +361,7 @@
     TSoInetIfQuery query;
     TPckg<TSoInetIfQuery> queryBuf(query);
     TInt res = KErrNone;
-    do 
+    do
     {
         res = socket.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, opt);
         if (!res && opt().iState == EIfUp)
@@ -371,30 +387,30 @@
     {
     MSRPLOG( "CMSRPConnectionManager::Remove connection enter" )
     TInt index = iConnectionArray.Find(aConn);
-    
+
     delete iConnectionArray[index];
-    iConnectionArray.Remove(index);       
+    iConnectionArray.Remove(index);
     MSRPLOG( "CMSRPConnectionManager::Remove connection exit" )
     }
 
 
-RSocketServ& CMSRPConnectionManager::SocketServer() 
+RSocketServ& CMSRPConnectionManager::SocketServer()
     {
     MSRPLOG( "CMSRPConnectionManager::SocketServer fetch enter" )
     MSRPLOG( "CMSRPConnectionManager::SocketServer fetch exit" )
     return iSocketServer;
-   
+
     }
-       
+
 RConnection& CMSRPConnectionManager::SocketServerConn()
     {
     MSRPLOG( "CMSRPConnectionManager::SocketServerConn fetch enter" )
     MSRPLOG( "CMSRPConnectionManager::SocketServerConn fetch exit" )
-    return iConnection;    
+    return iConnection;
     }
-       
+
 /*
-TBool CMSRPConnectionManager::MatchIapId(TUint32 aIapID) 
+TBool CMSRPConnectionManager::MatchIapId(TUint32 aIapID)
     {
     return (aIapID == iIapID);
     }
--- a/Msrp/MsrpServer/src/CMSRPConnector.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPConnector.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -70,15 +70,29 @@
 //
 void CMSRPConnector::ConstructL()
     {
+    MSRPLOG( "-> CMSRPConnector::ConstructL" )
     //iState = ENotConnected;
     iTimer = CMSRPTimeOutTimer::NewL( *this );
     //create socket
 
-    iSocket = new (ELeave) RSocket();   
-    User::LeaveIfError( iSocket->Open(
-            iConnMngr.SocketServer(), KAfInet, KSockStream, KProtocolInetTcp, iConnMngr.SocketServerConn()));
-    User::LeaveIfError( iSocket->SetOpt( KSoReuseAddr, KSolInetIp, ETrue ) );
-    iSocket->SetLocalPort(KMsrpPort);
+    iSocket = new (ELeave) RSocket();
+    RSocketServ& socketServ = iConnMngr.SocketServer();
+    RConnection& connection = iConnMngr.SocketServerConn();
+    TInt error = iSocket->Open( socketServ, KAfInet, KSockStream, KProtocolInetTcp, connection );
+    MSRPLOG2( "CMSRPConnector::ConstructL = open error = %d", error )
+    if ( error )
+        {
+        // if open fails, let's try to restart connection
+        MSRPLOG( "CMSRPConnector::ConstructL restarting interface" )
+        iConnMngr.ReStartInterface();
+        error = iSocket->Open( socketServ, KAfInet, KSockStream, KProtocolInetTcp, connection );
+        }
+    User::LeaveIfError( error );
+    error = iSocket->SetOpt( KSoReuseAddr, KSolInetIp, ETrue );
+    MSRPLOG2( "CMSRPConnector::ConstructL = opt error = %d", error )
+    User::LeaveIfError( error );
+    iSocket->SetLocalPort( KMsrpPort );
+    MSRPLOG( "<- CMSRPConnector::ConstructL" )
     }
 
 // -----------------------------------------------------------------------------
--- a/Msrp/MsrpServer/src/CMSRPMessageChunkState.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html."
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-* Contributors:
-*
-* Description:
-* MSRP Implementation
-*
-*/
-
-#include "CMSRPMessageChunkState.h"
-
-
-EXPORT_C CMSRPMessageChunkState* CMSRPMessageChunkState::NewL( )
-    {
-    CMSRPMessageChunkState* self = new (ELeave) CMSRPMessageChunkState( );
-    CleanupStack::PushL( self );
-   // self->ConstructL( );
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-EXPORT_C CMSRPMessageChunkState::~CMSRPMessageChunkState()
-    {
-  //  MSRPStrings::Close();
-    }
-
-CMSRPMessageChunkState::CMSRPMessageChunkState( )
-    {
-    }
-/*
-void CMSRPMessageChunkState::ConstructL( ) 
-    {
-  
-    }
-*/
-EXPORT_C void CMSRPMessageChunkState::SetStartPos(TInt aStartPos)
-    {
-    iStartPos = aStartPos ;
-    }
-
-EXPORT_C TInt CMSRPMessageChunkState::GetStartPos( )
-    {
-    return iStartPos;
-    }
-
-EXPORT_C void CMSRPMessageChunkState::SetEndPos(TInt aEndPos)
-    {
-    iEndPos = aEndPos ;
-    }
-
-EXPORT_C TInt CMSRPMessageChunkState::GetEndPos( )
-    {
-    return iEndPos;
-    }
-
-EXPORT_C TBool CMSRPMessageChunkState::GetResponseReceived()
-    {
-   if(iResponseReceived)
-       return ETrue;
-   else
-       return EFalse;
-    
-    }
-       
-EXPORT_C void CMSRPMessageChunkState::SetResponseReceived(TBool aResponseReceived)
-    {
-    iResponseReceived = aResponseReceived;
-    }
-
-EXPORT_C TDesC8& CMSRPMessageChunkState::GetTransactionId( )
-    {
-    return iTransactionId;
-    }
-
-EXPORT_C void CMSRPMessageChunkState::SetTransactionId(TDesC8& aTransactionId )
-    {
-    iTransactionId = aTransactionId ;
-    }
-
-EXPORT_C void CMSRPMessageChunkState::SetResponseSent(TBool aResponseSent)
-    {
-    iResponseSent = aResponseSent;
-    }
-
-EXPORT_C TBool CMSRPMessageChunkState::GetResponseSent( )
-    {
-    if(iResponseSent)
-        return ETrue;
-    else
-        return EFalse;
-    }
--- a/Msrp/MsrpServer/src/CMSRPMessageHandler.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPMessageHandler.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -25,6 +25,7 @@
 #include "MMSRPWriterObserver.h"
 #include "CMSRPMessage.h"
 #include "CMSRPResponse.h"
+#include "CMSRPReport.h"
 #include "CMSRPByteRangeHeader.h"
 #include "CMSRPToPathHeader.h"
 #include "CMSRPFromPathHeader.h"
@@ -37,6 +38,7 @@
 #include "TMSRPUtil.h"
 #include "MMSRPConnection.h"
 #include "MMSRPMessageObserver.h"
+#include "CMSRPStatusHeader.h"
 
 // Constants
 const TInt KEndlineConstLength = 10;
@@ -102,6 +104,10 @@
             iContentPtr.Set(iMessage->Content());
             }
         }    
+    else if ( CMSRPReport::IsReport( aMessage ) )
+        {
+        iReport = CMSRPReport::InternalizeL( readStream );
+        }
     else
         {
         User::Leave( KErrArgument );
@@ -110,6 +116,8 @@
     iBuffer.CreateL( KMaxBufferSize );
     iState = EIdle;
     MSRPStrings::OpenL();
+    
+    iFs.Connect();
     MSRPLOG( "CMSRPMessageHandler::ConstructL exit" )
     }
 
@@ -128,7 +136,7 @@
     else if( aMessageType == EMSRPReport )
         {
         // Since Reports are not supported now.. jus create a message class
-        iMessage = new ( ELeave ) CMSRPMessage();            
+        iReport = new ( ELeave ) CMSRPReport();            
         }
     else
         {
@@ -140,6 +148,7 @@
     iBuffer.CreateL( KSmallBuffer );
     iState = EIdle;    
     MSRPStrings::OpenL();
+    iFs.Connect();
     MSRPLOG( "CMSRPMessageHandler::ConstructL exit" )
     }
 
@@ -164,15 +173,16 @@
 //
 CMSRPMessageHandler::~CMSRPMessageHandler( )
     {
+    MSRPLOG2( "-> CMSRPMessageHandler::~CMSRPMessageHandler = %d", this )
     delete iMessage;
     delete iResponse;
     delete iFileBuffer;
+    iSentChunks.ResetAndDestroy();
+    iSentChunks.Close();
     iBuffer.Close();
     MSRPStrings::Close();
-    iChunkList.ResetAndDestroy();
-    iChunkList.Close();
-    //iFile.Flush();
     iFile.Close();
+    MSRPLOG( "<- CMSRPMessageHandler::~CMSRPMessageHandler" )
     }
 
 
@@ -184,6 +194,10 @@
         {
         messageBase = iResponse;
         }
+    else if ( iReport )
+        {
+        messageBase = iReport;
+        }
     else
         {
         messageBase = iMessage;
@@ -264,8 +278,11 @@
             }                
         case EStatus:        
             {
+            TInt statusValue = TMSRPUtil::ConvertToNumber( aHeaderValue );
+            messageBase->SetStatusHeader( CMSRPStatusHeader::NewL( statusValue ) );
             break; // required for reports only. Not handled now
             }              
+            
         default:             
             {
             break;
@@ -277,29 +294,45 @@
     }
 
     
-void CMSRPMessageHandler::AddContentL( TPtrC8& aContent )
+void CMSRPMessageHandler::AddContentL( TPtrC8& aContent, TBool aByteRangeFound )
     {
-    MSRPLOG( "CMSRPMessageHandler::AddContentL enter" )
+    MSRPLOG2( "CMSRPMessageHandler::AddContentL enter, instance = %d", this )
     if( iMessage )
         {
-        if( iBuffer.Length() + aContent.Length() > iBuffer.MaxLength() )
+        if ( aByteRangeFound )
             {
-            iBuffer.ReAllocL(iBuffer.Length() + aContent.Length());
-            iBuffer.Append(aContent);
+            if( iBuffer.Length() + aContent.Length() > iBuffer.MaxLength() )
+                {
+                HBufC8* combined = HBufC8::NewLC( iBuffer.Length() + aContent.Length() );
+                TPtr8 ptr = combined->Des();
+                ptr = iBuffer;
+                ptr.Append( aContent );
+                // must write to file
+                WriteMessageToFileL( ptr );
+                CleanupStack::PopAndDestroy( ); // combined
+                iBuffer.Zero();
+                }
+            else
+                {
+                iBuffer.Append( aContent );
+                iCurrentNumberOfBytes = iBuffer.Length();
+                }
             }
         else
             {
-            iBuffer.Append(aContent);
+            AppendMessageToFileL( aContent );
             }
         }    
     MSRPLOG( "CMSRPMessageHandler::AddContentL exit" )
     }
 
 
-void CMSRPMessageHandler::SetTransactionId( TPtrC8& aTransactionId )
+void CMSRPMessageHandler::SetTransactionId( TDesC8& aTransactionId )
     {
-    MSRPLOG( "CMSRPMessageHandler::SetTransactionId enter" )    
-    iTransactionId = aTransactionId;    
+    MSRPLOG( "CMSRPMessageHandler::SetTransactionId enter" )
+    HBufC8* transactionId = HBufC8::NewL( aTransactionId.Length() );
+    *transactionId = aTransactionId;
+    iSentChunks.Append( transactionId );
     MSRPLOG( "CMSRPMessageHandler::SetTransactionId exit" )
     }
 
@@ -320,15 +353,35 @@
 
 void CMSRPMessageHandler::EndOfMessageL( TMsrpMsgEndStatus aStatus )
     {
-    MSRPLOG( "CMSRPMessageHandler::EndOfMessageL enter" )  
-    if( iMessage && iBuffer.Length() )
+    MSRPLOG2( "CMSRPMessageHandler::EndOfMessageL enter = %d", this )
+    MSRPLOG2( "CMSRPMessageHandler::EndOfMessageL enter = %d", aStatus )
+    iMessageEnding = aStatus;
+    if( iMessage && iBuffer.Length() && ( aStatus == EMessageEnd ) )
         {
-        HBufC8* contentOfMessage = HBufC8::NewL( iBuffer.Length() );
-        *contentOfMessage = iBuffer;
-        iMessage->SetContent( contentOfMessage );
-        iBuffer.Zero();
+        if ( !iTempFileName.Length() )
+            {
+            HBufC8* contentOfMessage = HBufC8::NewL( iBuffer.Length() );
+            *contentOfMessage = iBuffer;
+            iMessage->SetContent( contentOfMessage );
+            iBuffer.Zero();
+            }
+        else
+            {
+            WriteMessageToFileL( iBuffer );
+            iBuffer.Zero();
+            }
         }
-    iMsgEndStatus = aStatus;    
+    if ( aStatus == EMessageEnd )
+        {
+        iState = EMessageDone;
+        }
+    
+    if( aStatus == EMessageTerminated )
+        {
+        iTerminateReceiving = ETrue;
+        iState = ETerminated;
+        }
+        
     MSRPLOG( "CMSRPMessageHandler::EndOfMessageL exit" )
     }
 
@@ -341,66 +394,13 @@
     }
 
 
-CMSRPMessage* CMSRPMessageHandler::GetIncomingMessage( )
+CMSRPMessage* CMSRPMessageHandler::GetIncomingMessage( ) const
     {
     MSRPLOG( "CMSRPMessageHandler::GetIncomingMessage enter" )  
-    if( iMessage )
-        {
-        return iMessage;
-        }
-    return NULL;
-    }
-
-
-void CMSRPMessageHandler::UpdateResponseStateL(CMSRPMessageHandler *incomingMsgHandler)
-    {
-    MSRPLOG( "CMSRPMessageHandler::UpdateResponseState enter" )
-    TBuf8<100> iTransactionId = incomingMsgHandler->TransactionId();
-    for(TInt i=0;i<iChunkList.Count();i++)
-       {
-        if(iTransactionId == iChunkList[i]->GetTransactionId())
-            {
-             iChunkList[i]->SetResponseSent(ETrue);
-             ReceiveFileStateL(iChunkList[i]->GetEndPos()- iChunkList[i]->GetStartPos() + 1);                    
-            }
-       }
-    MSRPLOG( "CMSRPMessageHandler::UpdateResponseState exit" )
+    return iMessage;
     }
 
-
-void CMSRPMessageHandler::ReceiveFileStateL( TInt aBytesTransferred )
-    {
-    MSRPLOG( "CMSRPMessageHandler::ReceiveFileState enter" )
-    MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState Notify %d", iProgress )
-    MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState iFileNotified %d", iNotifiedBytes )    
-    MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState iunnotified %d", iPendingBytes )
-    MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState aBytesTransferred %d", aBytesTransferred )
-    MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState iFileSize %d", iFileSize )
-    
-    iPendingBytes += aBytesTransferred;
-    
-    if(iNotifiedBytes + iPendingBytes == iFileSize)
-        {
-        iFileTransferComplete = ETrue;
-        }
-    
-    if(iPendingBytes >= KMaxChunkReadSize)
-        {
-        MSRPLOG( "CMSRPMessageHandler::ReceiveFileState unnotified exceeds threshold" )
-        MSRPLOG2( "CMSRPMessageHandler::ReceiveFileState iFileReceiveComplete: %d", iFileTransferComplete )                
-            
-        iNotifiedBytes += iPendingBytes;
-        iPendingBytes = 0;
-        //notify client of progress
-        if(iProgress && !iFileTransferComplete)
-            iMSRPMessageObserver->MessageReceiveProgressL(iNotifiedBytes, iFileSize);
-        }
- 
-     MSRPLOG( "CMSRPMessageHandler::ReceiveFileState exit" )   
-     }
-    
-
-TBool CMSRPMessageHandler::SendResponseL( MMSRPMessageObserver* aMessageObserver, 
+void CMSRPMessageHandler::SendResponseL( MMSRPMessageObserver* aMessageObserver, 
                                             MMSRPConnection& aConnection, TUint aResponseCode )
     {
     MSRPLOG( "CMSRPMessageHandler::SendResponseL enter" )
@@ -421,7 +421,7 @@
             sendResponse = EFalse;
             }
         else if( (frHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::EPartial ).DesC()) 
-                && (aResponseCode == CMSRPResponse::EAllOk) )
+                && (aResponseCode == EAllOk) )
             {
             sendResponse = EFalse;
             }
@@ -430,7 +430,7 @@
     
     if( !iMessage->ToPathHeader() || !iMessage->FromPathHeader() )
         {
-        aResponseCode = CMSRPResponse::EUnknownCode;
+        aResponseCode = EUnknownCode;
         sendResponse = EFalse;
         }
     
@@ -445,87 +445,137 @@
         
         HBufC8* toPathValue = iMessage->ToPathHeader()->ToTextValueLC();
         iResponse->SetFromPathHeader( CMSRPFromPathHeader::DecodeL( *toPathValue ) );
-        CleanupStack::PopAndDestroy(toPathValue);
+        CleanupStack::PopAndDestroy(toPathValue);   
         
         iActiveMsgType = EMSRPResponse;
+        iState = EIdle;
         aConnection.SendL( *this );
         }
   
     MSRPLOG( "CMSRPMessageHandler::SendResponseL exit" )
-	
-	if( aResponseCode == CMSRPResponse::EAllOk )
-        return ETrue;
-    else
-        return EFalse;
     }
 
-
-TBool CMSRPMessageHandler::IfResponseReqL()
+TBool CMSRPMessageHandler::SendReportL( 
+    MMSRPMessageObserver* aMessageObserver, 
+    MMSRPConnection& aConnection, TUint aStatusCode )
     {
-    TBool responseReq = ETrue;
-    if( iMessage->FailureReportHeader() )
+    MSRPLOG( "CMSRPMessageHandler::SendReportL enter" )
+    
+    TBool sendReport = EFalse;
+    if ( iActiveMsgType == EMSRPResponse )
         {
-        HBufC8* frHeaderValue = iMessage->FailureReportHeader()->ToTextValueLC();
-        if( frHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::ENo ).DesC() )
+        // currently sending a response
+        MSRPLOG( "CMSRPMessageHandler::SendReportL sendin a response..." )
+        return sendReport;
+        }
+    iMSRPMessageObserver = aMessageObserver;
+    if( iMessage->SuccessReportHeader() )
+        {
+        HBufC8* successHeaderValue = iMessage->SuccessReportHeader()->ToTextValueLC();
+        if( successHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::EYes ).DesC() )
             {
-             responseReq = EFalse;
-            }
-        else if( (frHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::EPartial ).DesC()))
-            {
-            responseReq = EFalse;
+            MSRPLOG( "CMSRPMessageHandler::SendReportL report needed!" )
+            sendReport = ETrue;
             }
-        CleanupStack::PopAndDestroy(frHeaderValue);     
+        CleanupStack::PopAndDestroy( successHeaderValue );
         }
-    return responseReq;
+        
+    if ( sendReport )
+        {
+        iReport = new ( ELeave ) CMSRPReport( ) ;
+        iReport->SetStatusHeader( CMSRPStatusHeader::NewL( aStatusCode ) );
+
+        HBufC8* fromPathValue = iMessage->FromPathHeader()->ToTextValueLC();
+        iReport->SetToPathHeader( CMSRPToPathHeader::DecodeL( *fromPathValue ) );
+        CleanupStack::PopAndDestroy(fromPathValue);
+        
+        HBufC8* toPathValue = iMessage->ToPathHeader()->ToTextValueLC();
+        iReport->SetFromPathHeader( CMSRPFromPathHeader::DecodeL( *toPathValue ) );
+        CleanupStack::PopAndDestroy(toPathValue);   
+
+        HBufC8* messageId = iMessage->MessageIdHeader()->ToTextValueLC();
+        iReport->SetMessageIdHeader( CMSRPMessageIdHeader::NewL( *messageId ) );
+        CleanupStack::PopAndDestroy( messageId );   
+        
+        TInt size( 0 );
+        if ( iTempFileName.Length() )
+            {
+            OpenTemporaryFileL( iTempFileName );
+            iTempFile->Size( size );
+            }
+        else
+            {
+            size = iBuffer.Length();
+            }
+        CMSRPByteRangeHeader* byteRange = 
+                CMSRPByteRangeHeader::NewL( 1, size, size );
+        iReport->SetByteRangeHeader( byteRange );
+        
+        iActiveMsgType = EMSRPReport;
+        iState = EIdle;
+        aConnection.SendL( *this );
+        }
+    MSRPLOG( "CMSRPMessageHandler::SendReportL exit" )
+    return sendReport;
     }
 
-
 TDesC8& CMSRPMessageHandler::TransactionId( )
     {
     MSRPLOG( "CMSRPMessageHandler::TransactionId enter" )
-    return iTransactionId;
+    return *iSentChunks[ iSentChunks.Count() - 1 ];
     }
 
 
-CMSRPResponse* CMSRPMessageHandler::GetIncomingResponse( )
+CMSRPResponse* CMSRPMessageHandler::GetIncomingResponse( ) const
     {
     MSRPLOG( "CMSRPMessageHandler::GetIncomingResponse enter" )
-    if( iResponse )
-        {
-        return iResponse;
-        }
-    return NULL;
+    return iResponse;
     }
 
+CMSRPReport* CMSRPMessageHandler::GetIncomingReport( ) const
+    {
+    MSRPLOG( "-> CMSRPMessageHandler::GetIncomingReport" )
+    return iReport;
+    }
 
 void CMSRPMessageHandler::SendMessageL( MMSRPConnection& aConnection )
     {
     MSRPLOG( "CMSRPMessageHandler::SendMessageL enter" )    
     iActiveMsgType = EMSRPMessage;
+    isSending = ETrue;
+    if ( iMessage->IsFile() )
+        {
+        User::LeaveIfError(iFile.Open(iFs, iMessage->GetFileName(), EFileShareReadersOrWriters)); 
+        iFile.Size(iFileSize);
+        iFileBuffer = HBufC8::NewL(KMaxChunkReadSize);            
+        FillFileBufferL();
+        }
+    else
+        {
+        iContentPtr.Set( iMessage->Content() );
+        }
+        
     aConnection.SendL( *this );
     MSRPLOG( "CMSRPMessageHandler::SendMessageL exit" )
     }
 
-
-void CMSRPMessageHandler::SendFileL(MMSRPConnection& aConnection)
+TBool CMSRPMessageHandler::IsOwnerOfResponse( MMSRPIncomingMessage& aIncomingMessage )
     {
-    MSRPLOG( "CMSRPMessageHandler::SendFileL enter" ) 
-    /* Flags  */
-    isFile = ETrue;    
-    iProgress = iMessage->GetNotifyProgress();
-    
-    User::LeaveIfError(iFs.Connect());
-    User::LeaveIfError(iFile.Open(iFs, iMessage->GetFileName(), EFileShareReadersOrWriters)); 
-    iFile.Size(iFileSize);
-    iFileBuffer = HBufC8::NewL(KMaxChunkReadSize);            
-    FillFileBufferL();
-    iActiveMsgType = EMSRPMessage;
-    aConnection.SendL( *this );
-    
-    MSRPLOG( "CMSRPMessageHandler::SendFileL exit" )     
+    MSRPLOG2( "CMSRPMessageHandler::IsOwnerOfResponse enter =%d", this )
+    for ( TInt i = 0; i < iSentChunks.Count(); i++ )
+        {
+        if( aIncomingMessage.TransactionId() == *iSentChunks[ i ] )
+            {
+            MSRPLOG( "CMSRPMessageHandler::IsOwnerOfResponse enter, yes" )
+            iResponseNeeded = EFalse;
+            return ETrue;
+            }  
+        }
+              
+    MSRPLOG( "CMSRPMessageHandler::IsOwnerOfResponse exit" )
+    return EFalse;
     }
 
-
 TInt CMSRPMessageHandler::FillFileBufferL()
     {    
     MSRPLOG( "CMSRPMessageHandler::FillFileBufferL enter" )
@@ -540,253 +590,100 @@
 	return iFileBuffer->Length();
     }
 
-
-void CMSRPMessageHandler::ReceiveFileL( )
+void CMSRPMessageHandler::TerminateReceiving( 
+    MMSRPMessageObserver* aMessageObserver, 
+    MMSRPConnection& aConnection )
     {
-    MSRPLOG( "CMSRPMessageHandler::ReceiveFileL enter" )
-    isFile = ETrue;
-    iProgress = iMessage->GetNotifyProgress();
-    
-    User::LeaveIfError(iFs.Connect());
-    User::LeaveIfError(iFile.Replace(iFs,iMessage->GetFileName(),EFileWrite));
-    iFileSize = iMessage->GetFileSize();
-    iFileBuffer = HBufC8::NewL(KMaxChunkReadSize);
-    
-    MSRPLOG( "CMSRPMessageHandler::ReceiveFileL exit" )
+    MSRPLOG( "CMSRPMessageHandler::SetFSTerminate" )
+    iTerminateReceiving = ETrue;
+
+    SendResponseL( aMessageObserver, aConnection, EStopSending );
     }
 
-
-void CMSRPMessageHandler::WritetoFileL(CMSRPMessageHandler *incomingMsgHandler )
+void CMSRPMessageHandler::TerminateSending()
     {
-    MSRPLOG( "CMSRPMessageHandler::WriteToFile enter" )
-    CMSRPMessage* inFileChunk = incomingMsgHandler->GetIncomingMessage();
-    HBufC8* messageContent = NULL;
-    if(inFileChunk->IsContent())
-        {
-        messageContent = HBufC8::NewL(inFileChunk->Content().Length());
-        *messageContent = inFileChunk->Content();        
-        WriteChunkToFileL(*messageContent,incomingMsgHandler->TransactionId());
-       
-        if (!incomingMsgHandler->IfResponseReqL())
-            ReceiveFileStateL(messageContent->Length());
-        }
-    delete messageContent;
-    MSRPLOG( "CMSRPMessageHandler::WriteToFile exit" )          
-    }               
-    
-    
-void CMSRPMessageHandler::WriteChunkToFileL(const TDesC8& aFileChunk ,TDesC8& aTransactionId)  
-    {    
-    MSRPLOG( "CMSRPMessageHandler::WriteChunktoFile enter" )      
-     if(iBufPosInFile<(iFileSize-1))
-       {
-       iFile.Write(iBufPosInFile,aFileChunk);
-       
-       /* Create and update the structure */
-       CMSRPMessageChunkState* iChunk = CMSRPMessageChunkState::NewL( ); 
-       iChunk->SetStartPos(iBufPosInFile);
-       iBufPosInFile += aFileChunk.Length();
-       iChunk->SetEndPos(iBufPosInFile-1);
-       iChunk->SetTransactionId(aTransactionId);
-       iChunkList.Append(iChunk);
-        }
-       else
-           {
-            //Receive Bytes greater than file Size
-            User::Leave( KErrArgument );
-           }
-  
-       MSRPLOG( "CMSRPMessageHandler::WriteChunktoFile exit" )
-     
+    MSRPLOG( "CMSRPMessageHandler::SetFSTerminate" )
+    iTerminateSending = ETrue;
     }
 
-
-TBool CMSRPMessageHandler::IsOwnerOfResponse( MMSRPIncomingMessage& aIncomingMessage )
+TBool CMSRPMessageHandler::IsTransmissionTerminated( )
     {
-    MSRPLOG( "CMSRPMessageHandler::IsOwnerOfResponse enter" )
-    if(isFile)
+    MSRPLOG3("-> CMSRPMessageHandler::IsTransmissionTerminated, %d and %d", iTerminateReceiving, iTerminateSending )
+    if ( iTerminateReceiving || iTerminateSending )
         {
-         /*  compare for transaction id  */
-        for(TInt i=0;i<iChunkList.Count();i++)
-           {
-            if(aIncomingMessage.TransactionId() == iChunkList[i]->GetTransactionId())
-             {
-             if( iState == EWaitingForResponse || ( iState == EMessageSent && iResponseNeeded ))
-                 {
-                   if (i == iChunkList.Count()-1)
-                     {
-                      iResponseNeeded = EFalse;
-                      iState = EMessageDone;
-                     }
-                 }
-               return ETrue;
-             }
-           }
+        return ETrue;
         }
-    if( aIncomingMessage.TransactionId() == iTransactionId )
-        {
-        if( iState == EWaitingForResponse || ( iState == EMessageSent && iResponseNeeded ))
-            {
-            iResponseNeeded = EFalse;
-            return ETrue;
-            }
-        }  
-              
-    MSRPLOG( "CMSRPMessageHandler::IsOwnerOfResponse exit" )
+        
     return EFalse;
     }
 
-
-void CMSRPMessageHandler::ConsumeFileResponseL(MMSRPIncomingMessage& aIncomingMessage )
+TBool CMSRPMessageHandler::IsReportNeeded( )
     {
-    MSRPLOG( "CMSRPMessageHandler::ConsumeFileResponseL enter" )
-    CMSRPResponse* response = aIncomingMessage.GetIncomingResponse();
-    TUint statusCode = response->StatusCode();
-    
-    for(TInt i=0;i<iChunkList.Count();i++)
-       {
-        if(aIncomingMessage.TransactionId()== iChunkList[i]->GetTransactionId())
-            {
-            iChunkList[i]->SetResponseReceived(ETrue);
-            SendFileStateL(iChunkList[i]->GetEndPos()- iChunkList[i]->GetStartPos() + 1 ) ;
-            }                     
-       }          
-      
-    MSRPLOG( "CMSRPMessageHandler::ConsumeFileResponseL exit" )     
-    } 
-
-
-void CMSRPMessageHandler::SendFileStateL(TInt aBytesTransferred )
-    {
-    MSRPLOG( "CMSRPMessageHandler::SendFileStateL enter" )
-    MSRPLOG2( "CMSRPMessageHandler::SendFileStateL granularity %d", iProgress )
-    MSRPLOG2( "CMSRPMessageHandler::SendFileStateL iFileNotified %d", iNotifiedBytes )    
-    MSRPLOG2( "CMSRPMessageHandler::SendFileStateL iunnotified %d", iPendingBytes )
-    MSRPLOG2( "CMSRPMessageHandler::SendFileStateL aBytesTransferred %d", aBytesTransferred )
-    MSRPLOG2( "CMSRPMessageHandler::SendFileStateL iFileSize %d", iFileSize )
-
-    iPendingBytes += aBytesTransferred;
-    
-    if(iNotifiedBytes + iPendingBytes == iFileSize)
+    if( iMessage->SuccessReportHeader() )
         {
-        iFileTransferComplete = ETrue;      
-        } 
-    
-    if(iPendingBytes  >= KMaxChunkReadSize)
-        {
-        MSRPLOG( "CMSRPMessageHandler::SendFileStateL unnotified exceeds threshold" )
-        MSRPLOG2( "CMSRPMessageHandler::SendFileStateL iFileSendComplete: %d", iFileTransferComplete )                
-        iNotifiedBytes += iPendingBytes;
-        iPendingBytes = 0;
-
-        //notify client of progress
-        if( iProgress && !iFileTransferComplete )//send progress requested and avoid double notifn. as send complete not handled in waitfor clientstate
-            iMSRPMessageObserver->MessageSendProgressL(iNotifiedBytes, iFileSize);//iByteinPos
-
+        HBufC8* successHeaderValue = iMessage->SuccessReportHeader()->ToTextValueLC();
+        if( successHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::EYes ).DesC() )
+            {
+            CleanupStack::PopAndDestroy( successHeaderValue );
+            return ETrue;
+            }
+        CleanupStack::PopAndDestroy( successHeaderValue );
         }
-    MSRPLOG( "CMSRPMessageHandler::SendFileStateL exit" )
-    }
-
-
-TBool CMSRPMessageHandler::FileTransferComplete( )
-    {
-    if(iFileTransferComplete)
-        return ETrue;
-    else
-        return EFalse;
-    }
-
-
-TBool CMSRPMessageHandler::IsInFile()
-    {
-    if(isFile)
-      {
-       return ETrue;
-      }
+        
     return EFalse;
     }
 
-
-TBool CMSRPMessageHandler::ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage )
+TUint CMSRPMessageHandler::ConsumeResponseL( MMSRPIncomingMessage& aIncomingMessage )
     {
-    MSRPLOG( "CMSRPMessageHandler::ConsumeResponseL enter" )
-    
-    TBool ret;
+    MSRPLOG2( "CMSRPMessageHandler::ConsumeResponseL enter, this = %d", this )
+   
+    TUint responseCode( EUnknownCode );
     CMSRPResponse* response = aIncomingMessage.GetIncomingResponse();
-    TUint statusCode = response->StatusCode();
-       
-    if( iMessage->FailureReportHeader() &&  
-            (iMessage->FailureReportHeader()->ToTextValueLC()->Des() == 
-            MSRPStrings::StringF( MSRPStrConsts::EPartial ).DesC()) &&
-                statusCode == CMSRPResponse::EAllOk )                
+    if ( response )
         {
-        iState = EMessageDone;
-        ret = EFalse;
-        }
-    else
-        {        
         RStringF statusString = response->ReasonPhrase();
-        iResponse = new (ELeave) CMSRPResponse( statusCode, statusString );
+        responseCode = response->StatusCode();
+        delete iResponse;
+        iResponse = NULL;
+        iResponse = new (ELeave) CMSRPResponse( responseCode, statusString );
         HBufC8* toPathValue = response->ToPathHeader()->ToTextValueLC();
         HBufC8* fromPathValue = response->FromPathHeader()->ToTextValueLC();
         iResponse->SetToPathHeader( CMSRPToPathHeader::DecodeL( toPathValue->Des() ) );
         iResponse->SetFromPathHeader( CMSRPFromPathHeader::DecodeL( fromPathValue->Des() ) );
         CleanupStack::PopAndDestroy(fromPathValue);
         CleanupStack::PopAndDestroy(toPathValue);
-        iState = EMessageDone;
-        ret = ETrue;
         }
-    
-    if( iMessage->FailureReportHeader() )
+
+    // removing the transaction id
+    for ( TInt i = 0; i < iSentChunks.Count(); i++ )
         {
-        CleanupStack::PopAndDestroy(); // FR header value from above
+        if( aIncomingMessage.TransactionId() == *iSentChunks[ i ] )
+            {
+            delete iSentChunks[ i ];
+            iSentChunks.Remove( i );
+            }  
         }
-         
+
+    if ( iState == EWaitingForResponse )
+        {
+        iState = EMessageDone;
+        }
+       
     MSRPLOG( "CMSRPMessageHandler::ConsumeResponseL exit" )
-    return ret;
+    return responseCode;
     }
 
 
 TBool CMSRPMessageHandler::IsMessageComplete()
     {
-    MSRPLOG( "CMSRPMessageHandler::IsMessageComplete enter" )
-    if( iState == EMessageDone )
-        return ETrue;
-    else
-        return EFalse;
-    }
-
-
-TBool CMSRPMessageHandler::GetSendResultL( TUint &aErrorCode, HBufC8* &aMessageId )
-    {
-    MSRPLOG( "CMSRPMessageHandler::GetSendResult enter" )
-    if( iState == EMessageDone )
+    MSRPLOG2( "CMSRPMessageHandler::IsMessageComplete enter= %d", this )
+    MSRPLOG2( "CMSRPMessageHandler::IsMessageComplete enter= %d", iMessageEnding )
+    MSRPLOG2( "CMSRPMessageHandler::IsMessageComplete enter= %d", iState )
+    if ( iMessageEnding != EMessageEnd && iMessageEnding != EMessageTerminated )
         {
-        aMessageId = iMessage->MessageIdHeader()->ToTextValueLC();
-        CleanupStack::Pop(aMessageId);
-        if(iResponse)
-            {
-            TUint code = iResponse->StatusCode();
-            if( code == CMSRPResponse::EAllOk )
-                {
-                aErrorCode = ENoError;
-                }
-            else if ( code == CMSRPResponse::ETimeout )
-                {
-                aErrorCode = ENetworkTimeout;
-                }
-            else
-                {
-                aErrorCode = EUnrecoverableError;
-                }            
-            }
-        else
-            {
-            aErrorCode = ENoError;
-            }
-        }    
-    MSRPLOG( "CMSRPMessageHandler::GetSendResult exit" )
-    if( aErrorCode == EUnrecoverableError )
+        return EFalse;
+        }
+    else if( iState == EMessageDone || iState == ETerminated )
         {
         return ETrue;
         }
@@ -797,7 +694,43 @@
     }
 
 
-MMSRPWriterObserver::TWriteStatus CMSRPMessageHandler::GetSendBufferL( TPtrC8& aData, TBool aInterrupt )
+TUint CMSRPMessageHandler::GetSendResultL( HBufC8* &aMessageId )
+    {
+    MSRPLOG( "CMSRPMessageHandler::GetSendResult enter" )
+    TUint aErrorCode( EUnknownCode );
+    aMessageId = iMessage->MessageIdHeader()->ToTextValueLC();
+    CleanupStack::Pop(aMessageId);
+    if(iResponse)
+        {
+        aErrorCode = iResponse->StatusCode();
+        }
+        
+    return aErrorCode;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::IsFailureHeaderPartial
+// -----------------------------------------------------------------------------
+//
+TBool CMSRPMessageHandler::IsFailureHeaderPartial()
+    {
+    if( iMessage->FailureReportHeader() )
+        {
+        HBufC8* frHeaderValue = iMessage->FailureReportHeader()->ToTextValueLC();
+        if( frHeaderValue->Des() == MSRPStrings::StringF( MSRPStrConsts::EPartial ).DesC() ) 
+            {
+            CleanupStack::PopAndDestroy(frHeaderValue);
+            return ETrue;
+            }
+        CleanupStack::PopAndDestroy(frHeaderValue);
+        }
+        
+    return EFalse;
+    }
+
+const TDesC8& CMSRPMessageHandler::GetSendBufferL( 
+    MMSRPWriterObserver::TWriteStatus& aStatus, 
+    TBool aInterrupt )
     {
     MSRPLOG( "CMSRPMessageHandler::GetSendBufferL enter" )
     iInterrupt = aInterrupt;
@@ -839,26 +772,21 @@
             }
         }
     
-    aData.Set(iBuffer);        
+    aStatus = EMsrpSocketWrite;
     MSRPLOG( "CMSRPMessageHandler::GetSendBufferL exit" )
-    return EMsrpSocketWrite;
+    return iBuffer;
     }
 
 
 MMSRPWriterObserver::TMsgStatus CMSRPMessageHandler::WriteDoneL( TInt aStatus )
     {
     MSRPLOG( "CMSRPMessageHandler::WriteDoneL enter" )
+    MSRPLOG2( "CMSRPMessageHandler::WriteDoneL state = %d", iState )
+    MSRPLOG2( "CMSRPMessageHandler::WriteDoneL activestate = %d", iActiveMsgType )
     MMSRPWriterObserver::TMsgStatus retStatus = EUndefined;
 
     if( !aStatus )
         {
-        /*if file send and message and response not needed, update progress*/
-        if (isFile && iActiveMsgType == EMSRPMessage && iResponseNeeded == FALSE)
-            {
-            if (iFileBytesSent > 0)
-                SendFileStateL(iFileBytesSent);
-            }
-        
         if( iState == EMessageSent )
             {
             switch( iActiveMsgType )
@@ -873,34 +801,73 @@
                         {
                         iState = EMessageDone;
                         }  
-                    iMSRPMessageObserver->MessageSendCompleteL();
+                    iMSRPMessageObserver->MessageSendProgressL( this );   
+                    iMSRPMessageObserver->MessageSendCompleteL( this );
+                    retStatus = MMSRPWriterObserver::EComplete;
                     break;                    
                     }
                 case EMSRPResponse:
                     {
+                    if( iTerminateReceiving )
+                        {
+                        iState = ETerminated;
+                        iMessageEnding = EMessageTerminated;
+                        }
+                    else
+                        {
+                        iState = EMessageDone;
+                        }
+                    iActiveMsgType = EMSRPNotDefined;
+                    iMSRPMessageObserver->MessageResponseSendCompleteL(*this);
+                    if ( IsReportNeeded() )
+                        {
+                        retStatus = MMSRPWriterObserver::ESendingReport;
+                        }
+                    else
+                        {
+                        retStatus = MMSRPWriterObserver::EComplete;
+                        }
+                    break;
+                    }
+                case EMSRPReport:
+                    {
+                    iMessageEnding = EMessageEnd;
                     iState = EMessageDone;
-                    iMSRPMessageObserver->MessageResponseSendCompleteL(*this);
+                    iMSRPMessageObserver->MessageReportSendCompleteL( *this );
+                    retStatus = MMSRPWriterObserver::EComplete;
                     break;
                     }
                 }
-            //iActiveMsgType = EMSRPNotDefined;
-            retStatus = MMSRPWriterObserver::EComplete;
             }        
         else if( iState ==  EInProgress )
             {
-            retStatus = MMSRPWriterObserver::EPending;
-            }            
-        else if(iState == EChunkSent)
+            iMSRPMessageObserver->MessageSendProgressL( this ); 
+            if ( iMessageEnding == EMessageNotDefined )
+                {
+                retStatus = MMSRPWriterObserver::EPending;
+                }
+            else
+                {
+                iState = EIdle;
+                retStatus = MMSRPWriterObserver::EWaitingForResponse;
+                }
+            }
+        else if( iState == ETerminated )
             {
-            retStatus = MMSRPWriterObserver::EInterrupted;
-            iState = EIdle;
-            }        
+            if( iResponseNeeded )
+                {
+                iState = EWaitingForResponse;
+                }
+                                        
+            iMSRPMessageObserver->MessageCancelledL();
+            retStatus = MMSRPWriterObserver::EComplete;
+            }
         else
            {
            iMSRPMessageObserver->WriterError();
            }
         }
-    MSRPLOG( "CMSRPMessageHandler::WriteDone exit" )
+
     return retStatus;
     }
 
@@ -913,35 +880,25 @@
     if ( iMessage->IsFile())
         {                
         byteRange = CMSRPByteRangeHeader::NewL( iBufPosInFile+iStartPosInBuffer+1,KUnknownRange,iFileSize);
-      
-        CleanupStack::PushL(byteRange);
-        iMessage->SetByteRangeHeader( byteRange );
-        CleanupStack::Pop(byteRange);
         }
     else
         {
-        if( !iMessage->ByteRangeHeader() )
-            {
-             if ( iMessage->IsContent() )
-                 {
-                 byteRange = CMSRPByteRangeHeader::NewL( 1,
-                 iMessage->Content().Length(), iMessage->Content().Length() );
-                 CleanupStack::PushL(byteRange);
-                 }
-             else
-                 {
-                 byteRange = CMSRPByteRangeHeader::NewL( 1, 0, 0 );
-                 CleanupStack::PushL(byteRange);
-                 }
-            iMessage->SetByteRangeHeader( byteRange );
-            CleanupStack::Pop(byteRange);
-            }
+        if ( iMessage->IsContent() )
+             {
+             byteRange = CMSRPByteRangeHeader::NewL( 1,
+             iMessage->Content().Length(), iMessage->Content().Length() );
+             }
+        else
+             {
+             byteRange = CMSRPByteRangeHeader::NewL( 1, 0, 0 );
+             }
         }
+    iMessage->SetByteRangeHeader( byteRange );
     MSRPLOG( "CMSRPMessageHandler::CreateByteRangeHeaderL exit" )
     }
 
 
-void CMSRPMessageHandler::CreateTransactionId()
+void CMSRPMessageHandler::CreateTransactionIdL()
     {
     MSRPLOG( "CMSRPMessageHandler::CreateTransactionId enter" )
     
@@ -949,7 +906,75 @@
     now.HomeTime();
     TInt64 seed = now.Int64();
     TInt random = Math::Rand( seed );
-    iTransactionId.NumUC( random );
+    HBufC8* transactionId = HBufC8::NewL( KMaxLengthOfTransactionIdString );
+    TPtr8 temp( transactionId->Des() );
+    temp.NumUC( random );
+    
+    if ( iActiveMsgType != EMSRPReport )
+        {
+        // let's make sure the message content does not include the end line
+        // otherwise we need to regenerate the random number
+        TBuf8< KMaxLengthOfMessageEndString > endLine;
+        endLine.Append( KAsterisk );
+        endLine.Append( KDashLine );
+        endLine.Append( temp );
+        endLine.Append( KAsterisk );
+        
+        if ( iMessage->IsFile() )
+            {
+            // must first load the right chunk to memory temporarily
+            RFile file;
+            CleanupClosePushL( file );
+            User::LeaveIfError(
+                file.Open( iFs, iMessage->GetFileName(), EFileShareReadersOrWriters ) );
+        
+            // Check that the file does not contain the generated ID
+            TInt readPosition( 0 );
+            HBufC8* tempFileBuffer = HBufC8::NewLC( KMaxChunkReadSize );
+            TPtr8 fileBuffer( tempFileBuffer->Des() );
+            User::LeaveIfError(
+                file.Read( readPosition, fileBuffer, KMaxChunkReadSize ) );
+            while ( fileBuffer.Length() )
+                {
+                if ( fileBuffer.Match( endLine ) != KErrNotFound )
+                    {
+                    // found
+                    random = Math::Rand( seed );
+                    temp.NumUC( random );
+                    endLine.Zero();
+                    endLine.Append( KAsterisk );
+                    endLine.Append( KDashLine );
+                    endLine.Append( temp );
+                    endLine.Append( KAsterisk );
+                    readPosition = 0;
+                    }
+                else
+                    {
+                    readPosition += ( KMaxChunkReadSize - KMaxLengthOfMessageEndString );
+                    }
+                User::LeaveIfError(
+                    file.Read( readPosition, fileBuffer, KMaxChunkReadSize ) );
+                }
+            CleanupStack::PopAndDestroy( tempFileBuffer );
+            CleanupStack::PopAndDestroy( ); // file
+            }
+        else
+            {
+            // content
+            while ( iMessage->Content().Match( temp ) != KErrNotFound )
+                {
+                // found
+                random = Math::Rand( seed );
+                temp.NumUC( random );
+                endLine.Zero();
+                endLine.Append( KAsterisk );
+                endLine.Append( KDashLine );
+                endLine.Append( temp );
+                endLine.Append( KAsterisk );
+                }
+            }
+        }
+    iSentChunks.Append( transactionId );
     
     MSRPLOG( "CMSRPMessageHandler::CreateTransactionId exit" )
     }
@@ -959,16 +984,20 @@
     {
     MSRPLOG( "CMSRPMessageHandler::WriteInitialLineToBufferL enter" )
     
+    if( iActiveMsgType == EMSRPMessage )
+        {
+        iMessageEnding = EMessageNotDefined;
+        }
     iBuffer.Append( MSRPStrings::StringF( MSRPStrConsts::EMSRP ).DesC() );
 
     iBuffer.Append( KSpaceChar );
     
     if (! (iActiveMsgType == EMSRPResponse) )
          {
-         CreateTransactionId();
+         CreateTransactionIdL();
          }
    
-    iBuffer.Append( iTransactionId );
+    iBuffer.Append( *iSentChunks[ iSentChunks.Count() -1 ] );
 
     iBuffer.Append( KSpaceChar );
     
@@ -984,6 +1013,10 @@
         iBuffer.Append( KSpaceChar );
         iBuffer.Append( iResponse->ReasonPhrase().DesC() );
         }
+    else if ( iActiveMsgType == EMSRPReport )
+        {
+        iBuffer.Append( MSRPStrings::StringF( MSRPStrConsts::EReport ).DesC() );
+        }
     else
         {
         User::Leave( KErrArgument );
@@ -1008,6 +1041,10 @@
         {
         messageBase = iResponse;
         }
+    else if ( iActiveMsgType == EMSRPReport )
+        {
+        messageBase = iReport;
+        }
     else
         {
         User::Leave( KErrArgument );
@@ -1045,8 +1082,7 @@
         if ( messageBase->FailureReportHeader() )
             {
             HBufC8* valueString = messageBase->FailureReportHeader()->ToTextValueLC();
-            if ( valueString->Des() == MSRPStrings::StringF( MSRPStrConsts::EYes ).DesC() ||
-                valueString->Des() == MSRPStrings::StringF( MSRPStrConsts::EPartial ).DesC() )
+            if ( valueString->Des() == MSRPStrings::StringF( MSRPStrConsts::EYes ).DesC() )
                 {
                 iResponseNeeded = ETrue;
                 }
@@ -1068,7 +1104,14 @@
         CleanupStack::PopAndDestroy(); // above 
         iBuffer.Append( KCRAndLF );
         }
-    
+
+    if( iActiveMsgType == EMSRPReport )
+        {
+        iBuffer.Append( messageBase->StatusHeader()->ToTextLC()->Des() );
+        CleanupStack::PopAndDestroy(); // above 
+        iBuffer.Append( KCRAndLF );
+        }
+        
     if( iActiveMsgType == EMSRPMessage )
         {
         if ( messageBase->ContentTypeHeader() )
@@ -1092,29 +1135,29 @@
 void CMSRPMessageHandler::WriteFileContentToBufferL()
     {
     MSRPLOG( "CMSRPMessageHandler::WriteFileContentToBuffer enter" )
-    TInt endlineSize = iTransactionId.Length() + KEndlineConstLength;
+    TInt endlineSize = iSentChunks[ iSentChunks.Count() -1 ]->Length() + KEndlineConstLength;
     TInt remBufferSize = iBuffer.MaxLength() - iBuffer.Length() - endlineSize - KCRAndLF().Length();
     TInt chunkLength = iFileBuffer->Length() - iEndPosInBuffer;
     
-    /*if(remBufferSize<0) TODO*/
     if(chunkLength > remBufferSize)
         {
         iFileBytesSent = remBufferSize;
         iBuffer.Append(iFileBuffer->Mid(iEndPosInBuffer, iFileBytesSent));
         iEndPosInBuffer += iFileBytesSent;
-        if(iInterrupt)
+        
+        if( iTerminateSending )
             {
+            iBuffer.Append(KCRAndLF());
+            WriteEndLineToBuffer( EMessageTerminated );
+            iStartPosInBuffer = iEndPosInBuffer;
+            iState = ETerminated;
+            }
+        else if(iInterrupt)
+            {
+            iBuffer.Append(KCRAndLF());
             WriteEndLineToBuffer(EMessageContinues);
-            //add chunk entry
-            CMSRPMessageChunkState* iChunk = CMSRPMessageChunkState::NewL( ); 
-            iChunk->SetStartPos(iBufPosInFile+iStartPosInBuffer);           
-            iChunk->SetEndPos(iBufPosInFile+iEndPosInBuffer-1);//since endpos is pointing to next start pos 
-            iChunk->SetTransactionId(iTransactionId);
-            iChunkList.Append(iChunk);
-
             iStartPosInBuffer = iEndPosInBuffer;
-            iState = EChunkSent;
-            }
+            }        
        /* else
             {
             //msg state remains InProgress (in write done return pending)
@@ -1125,28 +1168,49 @@
         iFileBytesSent = chunkLength;
         iBuffer.Append(iFileBuffer->Mid(iEndPosInBuffer, iFileBytesSent));
         iEndPosInBuffer += iFileBytesSent;
+        
+        if ( FillFileBufferL() == 0 )
+            {
+            iBuffer.Append( KCRAndLF( ) );
+            WriteEndLineToBuffer( EMessageEnd );
+            iState = EMessageSent;
+            }
+        
+        if( iTerminateSending && iState != EMessageSent )
+            {
+            iBuffer.Append( KCRAndLF( ) );
+            WriteEndLineToBuffer( EMessageTerminated );
+            iState = ETerminated;
+            }
+        }
+#if 0
+/* This is an alternative piece of code which writes the message in chunks. 
+ * The size of chunk is determined by the size of the iBuffer
+ */
+    else //bytes completed in current file buffer
+        {
+        iFileBytesSent = chunkLength;
+        iBuffer.Append(iFileBuffer->Mid(iEndPosInBuffer, iFileBytesSent));
+        iEndPosInBuffer += iFileBytesSent;
         iBuffer.Append(KCRAndLF());
         
-        //add chunk entry
-        CMSRPMessageChunkState* iChunk = CMSRPMessageChunkState::NewL( ); 
-        iChunk->SetStartPos(iBufPosInFile+iStartPosInBuffer);           
-        iChunk->SetEndPos(iBufPosInFile+iEndPosInBuffer-1); 
-        iChunk->SetTransactionId(iTransactionId);
-        iChunkList.Append(iChunk);
-        
-        if(FillFileBufferL() > 0)
+        if(iTerminateFS)
+            {
+            WriteEndLineToBuffer(EMessageTerminated);
+            iState = ETerminated;
+            }
+        else if(FillFileBufferL() > 0)
             {
             //next file buffer has data
             WriteEndLineToBuffer(EMessageContinues);
-            iState = EChunkSent;        
             }
         else
             {
             WriteEndLineToBuffer(EMessageEnd);
             iState = EMessageSent;
             }
-
         }
+#endif
     
     iWriteDone = ETrue;
     MSRPLOG( "CMSRPMessageHandler::WriteFileContentToBuffer exit" )
@@ -1182,12 +1246,12 @@
     MSRPLOG( "CMSRPMessageHandler::WriteEndLineToBuffer enter" )
         
     TInt remBufferSize = iBuffer.MaxLength() - iBuffer.Length();        
-    TInt endlineSize = iTransactionId.Length() + KEndlineConstLength;
+    TInt endlineSize = iSentChunks[ iSentChunks.Count() -1 ]->Length() + KEndlineConstLength;
     
     if( endlineSize <= remBufferSize )
         {
         iBuffer.Append( KDashLine );
-        iBuffer.Append( iTransactionId );
+        iBuffer.Append( *iSentChunks[ iSentChunks.Count() -1 ] );
         
         if(iActiveMsgType == EMSRPResponse)
             {
@@ -1196,18 +1260,29 @@
             }
         else
             {
-            if( aEndFlag )
-               {
-               iBuffer.Append( KMessageContinuesSign );
-               }
+            if( aEndFlag == EMessageTerminated )
+                {
+                MSRPLOG( "CMSRPMessageHandler::WriteEndLineToBuffer - Appending #" )    
+                iBuffer.Append( KMessageTerminatedSign );
+                iMessageEnding = EMessageTerminated;
+                }
+            else if( aEndFlag == EMessageContinues )
+                {
+                MSRPLOG( "CMSRPMessageHandler::WriteEndLineToBuffer - Appending +" )
+                iBuffer.Append( KMessageContinuesSign );
+                iMessageEnding = EMessageContinues;
+                }
             else
-               {
-               iBuffer.Append( KMessageEndSign );
-               iState = EMessageSent;
-               }
+                {
+                MSRPLOG( "CMSRPMessageHandler::WriteEndLineToBuffer - Appending $" )
+                iBuffer.Append( KMessageEndSign );
+                iMessageEnding = EMessageEnd;
+                iState = EMessageSent;
+                }
             }
         iBuffer.Append( KCRAndLF );        
-        }        
+        }
+        
     iWriteDone = ETrue;
     MSRPLOG( "CMSRPMessageHandler::WriteEndLineToBuffer exit" )
     }
@@ -1252,52 +1327,52 @@
     
     switch( aStatusCode )
         {
-        case CMSRPResponse::EAllOk:
+        case EAllOk:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EAllOk );
             break;
             }
-        case CMSRPResponse::EUnintelligibleRequest:
+        case EUnintelligibleRequest:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EUnintelligibleRequest );
             break;
             }
-        case CMSRPResponse::EActionNotAllowed:
+        case EActionNotAllowed:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EActionNotAllowed );
             break;
             }
-        case CMSRPResponse::ETimeout:
+        case ETimeout:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::ETimeout );
             break;
             }
-        case CMSRPResponse::EStopSending:
+        case EStopSending:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EStopSending );
             break;
             }
-        case CMSRPResponse::EMimeNotUnderstood:
+        case EMimeNotUnderstood:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EMimeNotUnderstood );
             break;
             }
-        case CMSRPResponse::EParameterOutOfBounds:
+        case EParameterOutOfBounds:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EParameterOutOfBounds );
             break;
             }
-        case CMSRPResponse::ESessionDoesNotExist:
+        case ESessionDoesNotExist:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::ESessionDoesNotExist );
             break;
             }
-        case CMSRPResponse::EUnknownRequestMethod:
+        case EUnknownRequestMethod:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::EUnknownRequestMethod );
             break;
             }
-        case CMSRPResponse::ESessionAlreadyBound:
+        case ESessionAlreadyBound:
             {
             statusString = MSRPStrings::StringF( MSRPStrConsts::ESessionAlreadyBound );
             break;
@@ -1322,16 +1397,235 @@
         {
         if(!aMessage->MessageIdHeader())
             {
-            return CMSRPResponse::EUnintelligibleRequest;
+            return EUnintelligibleRequest;
             }
         CMSRPMessage* message = static_cast<CMSRPMessage*>(aMessage);
         if(message->IsContent() && !message->ContentTypeHeader())
             {
-            return CMSRPResponse::EUnintelligibleRequest;
+            return EUnintelligibleRequest;
             }
         }
     
     MSRPLOG( "CMSRPMessageHandler::CheckValidityOfMessage exit" )
-    return CMSRPResponse::EAllOk;
+    return EAllOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::OpenTemporaryFileL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::OpenTemporaryFileL( const TDesC& aFilename )
+    {
+    MSRPLOG( "CMSRPMessageHandler::OpenTemporaryFileL enter" )
+
+    iTempFile = new ( ELeave ) RFile();
+    // create temporary filename
+    iTempFile->Open( iFs, aFilename, EFileShareExclusive | EFileWrite );
+
+    MSRPLOG2( "CMSRPMessageHandler::OpenTemporaryFileL exit, filename = %S", &iTempFileName )
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::CreateTemporaryFileL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::CreateTemporaryFileL( )
+    {
+    MSRPLOG( "CMSRPMessageHandler::CreateTemporaryFileL enter" )
+
+    iTempFile = new ( ELeave ) RFile();
+    // create temporary filename
+    User::LeaveIfError( iTempFile->Temp(
+        iFs, KDefaultTempFilePath, iTempFileName, EFileShareExclusive | EFileWrite ) );
+    iMessage->SetFileName( iTempFileName );
+
+    MSRPLOG2( "CMSRPMessageHandler::CreateTemporaryFileL exit, filename = %S", &iTempFileName )
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::WriteMessageToFileL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::WriteMessageToFileL( TDesC8& aBuffer )
+    {
+    MSRPLOG( "CMSRPSocketReader::WriteMessageToFileL enter" )
+
+    if ( !iTempFileName.Length() )
+        {
+        CreateTemporaryFileL();
+        }
+    else
+        {
+        OpenTemporaryFileL( iTempFileName );
+        }
+
+    MSRPLOG2( "CMSRPSocketReader::WriteMessageToFileL writing to file = %S", &iMessage->GetFileName() );
+
+    TInt fileSize;
+    iTempFile->Size( fileSize );
+    if ( iMessage->ByteRangeHeader()->StartPosition() > fileSize )
+        {
+        iTempFile->SetSize(
+            iMessage->ByteRangeHeader()->StartPosition() );
+        }
+    iTempFile->Size( fileSize );
+
+    iTempFile->Write(
+        iMessage->ByteRangeHeader()->StartPosition() - 1, aBuffer );
+    MSRPLOG2( "CMSRPSocketReader::WriteMessageToFileL writing to pos = %d", iMessage->ByteRangeHeader()->StartPosition() - 1 );
+    iTempFile->Size( iCurrentNumberOfBytes );
+    iTempFile->Close();
+    delete iTempFile;
+    iTempFile = NULL;
+                        
+    MSRPLOG( "CMSRPSocketReader::WriteMessageToFileL exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::AppendMessageToFileL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::AppendMessageToFileL( TDesC8& aBuffer )
+    {
+    MSRPLOG( "CMSRPSocketReader::AppendMessageToFileL enter" )
+    OpenTemporaryFileL( iMessage->GetFileName() );
+
+    TInt filePos( 0 );
+    iTempFile->Seek( ESeekEnd, filePos );
+
+TInt fileSize;
+iTempFile->Size( fileSize );
+MSRPLOG2( "CMSRPSocketReader::AppendMessageToFileL writing to pos = %d", fileSize );
+
+    iTempFile->Write( aBuffer );
+    iTempFile->Size( iCurrentNumberOfBytes );
+    iTempFile->Close();
+    delete iTempFile;
+    iTempFile = NULL;
+
+    MSRPLOG( "CMSRPSocketReader::AppendMessageToFileL exit" )
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::MessageId
+// -----------------------------------------------------------------------------
+//
+HBufC8* CMSRPMessageHandler::MessageIdLC( )
+    {
+    return iMessage->MessageIdHeader()->ToTextValueLC();
     }
 
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::CurrentReceiveProgress
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::CurrentReceiveProgress( TInt& aBytesTransferred, TInt& aTotalBytes )
+    {
+    aBytesTransferred = iCurrentNumberOfBytes;
+    aTotalBytes = iMessage->ByteRangeHeader()->TotalLength(); 
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::CurrentSendProgress
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::CurrentSendProgress( TInt& aBytesTransferred, TInt& aTotalBytes )
+    {
+    if ( iBufPosInFile )
+        {
+        aBytesTransferred = iBufPosInFile;
+        aTotalBytes = iFileSize; 
+        }
+    else
+        {
+        aBytesTransferred = iMessage->Content().Length() - iContentPtr.Length();
+        aTotalBytes = iMessage->Content().Length(); 
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::CheckMessageChunk
+// -----------------------------------------------------------------------------
+//
+TBool CMSRPMessageHandler::CheckMessageChunkL( CMSRPMessageHandler& aOtherMessage )
+    {
+    MSRPLOG( "-> CMSRPMessageHandler::CheckMessageChunk" )
+    HBufC8* ownToPath = iMessage->ToPathHeader()->ToTextValueLC(); 
+    HBufC8* ownMessageId = iMessage->MessageIdHeader()->ToTextValueLC();
+    HBufC8* otherToPath = aOtherMessage.GetIncomingMessage()->ToPathHeader()->ToTextValueLC();
+    HBufC8* otherMessageId = aOtherMessage.GetIncomingMessage()->MessageIdHeader()->ToTextValueLC();
+    
+    if ( *ownToPath == *otherToPath && *ownMessageId == *otherMessageId )
+        {
+        CleanupStack::PopAndDestroy( 4 ); // above texts
+        MSRPLOG( "CMSRPMessageHandler::CheckMessageChunk MATCH!" )
+        // there is already a message, this chunk belongs to a previous
+        // message 
+        if ( iMessage->ByteRangeHeader() )
+            {
+            CMSRPByteRangeHeader* byteR = CMSRPByteRangeHeader::NewL(
+                    iMessage->ByteRangeHeader()->StartPosition( ),
+                    iMessage->ByteRangeHeader()->EndPosition( ),
+                    iMessage->ByteRangeHeader()->TotalLength( ) );
+            aOtherMessage.GetIncomingMessage()->SetByteRangeHeader( byteR );
+            }
+        aOtherMessage.SetTransactionId( *iSentChunks[ iSentChunks.Count() -1 ] );
+        MSRPLOG( "CMSRPMessageHandler::CheckMessageChunk MATCH2!" )
+        return ETrue;
+        }
+        
+    CleanupStack::PopAndDestroy( 4 ); // above texts
+    MSRPLOG( "<- CMSRPMessageHandler::CheckMessageChunk" )
+    return EFalse;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::CheckMessageChunk
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::SetMessageObserver( MMSRPMessageObserver* aMessageObserver )
+    {
+    iMSRPMessageObserver = aMessageObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::IsSending
+// -----------------------------------------------------------------------------
+//
+TBool CMSRPMessageHandler::IsSending( )
+    {
+    return isSending;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::TemporaryFileName
+// -----------------------------------------------------------------------------
+//
+TFileName& CMSRPMessageHandler::TemporaryFileName( )
+    {
+    return iTempFileName;
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::SetTemporaryFileName
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::SetTemporaryFileName( TFileName aFileName ) 
+    {
+    iTempFileName = aFileName; 
+    iMessage->SetFileName( iTempFileName );
+    }
+
+// -----------------------------------------------------------------------------
+// CMSRPMessageHandler::ResponseHandled
+// -----------------------------------------------------------------------------
+//
+void CMSRPMessageHandler::ResponseHandled( )
+    {
+    delete iResponse;
+    iResponse = NULL;
+    iActiveMsgType = EMSRPMessage;
+    iBuffer.Zero();
+    }
+
+// End of file
--- a/Msrp/MsrpServer/src/CMSRPMsgParser.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPMsgParser.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -20,6 +20,9 @@
 #include "CMSRPMsgParser.h"
 #include "MSRPCommon.h"
 
+#include "CMSRPMessage.h"
+#include "CMSRPToPathHeader.h"
+
 // -----------------------------------------------------------------------------
 // CMSRPMsgParser::NewL
 // Static constructor
@@ -60,6 +63,8 @@
     delete iMessage;
     iParseBuffers.ResetAndDestroy();
     iParseBuffers.Close();    
+    iIncomingMessageChunks.ResetAndDestroy();
+    iIncomingMessageChunks.Close();
     MSRPLOG( "CMSRPMsgParser::~CMSRPMsgParser exit" )
     }
 
@@ -86,6 +91,7 @@
     {
     TMatchType match = EFullMatch;
     TBool ret = TRUE;
+    iByteRangeHeaderFound = EFalse;
 
     /*parse until a parse element spans buffers. 
       if parse element completes exactly at buffer boundaries,
@@ -107,7 +113,7 @@
             token.Set(iEndToken->Des());                
             }   
         
-        TInt matchPos;
+        TInt matchPos( 0 );
         match = FindToken(iParseBuffers[0]->Ptr(),token,matchPos);    
         if(match == EFullMatch)
             {
@@ -330,6 +336,7 @@
 void CMSRPMsgParser::HandleTitleLineL(const TDesC8& aString, TInt /*aMatchPos*/)
     {
     MSRPLOG( "CMSRPMsgParser::HandleTitleLineL enter" )
+    
     TPtrC8 msrp(aString.Left(KMSRP().Length()));
     if(msrp.Compare(KMSRP()))
         User::LeaveIfError(KErrCorrupt);
@@ -362,24 +369,32 @@
         
         method.Set(method.Left(pos));
                 
+        delete iMessage;
+        iMessage = NULL;
          if (!method.Compare(KMSRPSend()))
              {
              iMessage = CMSRPMessageHandler::NewL(MMSRPIncomingMessage::EMSRPMessage);
+             MSRPLOG2( "CMSRPMsgParser::HandleTitleLineL new message = %d", iMessage )
              }
-         else if (!method.Compare(KMSRPReport()))
+         else if ( !method.Compare( KMSRPReport() ) )
              {
-             iMessage = CMSRPMessageHandler::NewL(MMSRPIncomingMessage::EMSRPReport);
+             iMessage = CMSRPMessageHandler::NewL( MMSRPIncomingMessage::EMSRPReport );
+             MSRPLOG2( "CMSRPMsgParser::HandleTitleLineL new report = %d", iMessage )
              }
          else //extn
              {
              iMessage = CMSRPMessageHandler::NewL(MMSRPIncomingMessage::EMSRPNotDefined);
+             MSRPLOG2( "CMSRPMsgParser::HandleTitleLineL new not defined = %d", iMessage )
              }        
         }
     else //response
         {
         TPtrC8 null;
         method.Set(method.Left(pos));
+        delete iMessage;
+        iMessage = NULL;
         iMessage = CMSRPMessageHandler::NewL(MMSRPIncomingMessage::EMSRPResponse);
+        MSRPLOG2( "CMSRPMsgParser::HandleTitleLineL new response = %d", iMessage )
         iMessage->SetStatusOfResponseL(method, null);
         }    
     iMessage->SetTransactionId(trans_id);
@@ -526,6 +541,7 @@
             }
         else if(!header_name.Compare(KMSRPByteRange()))
             {
+            iByteRangeHeaderFound = ETrue;
             headerType = MMSRPMessageHandler::EByteRange;
             }
         else if(!header_name.Compare(KMSRPSuccessReport()))
@@ -550,6 +566,13 @@
     //message->add_header
     TPtrC8 fullHeader(aString);
     iMessage->AddHeaderL(headerType, header_val, fullHeader);
+    if ( headerType == MMSRPMessageHandler::EMessageId )
+        {
+        // let's check if this message chunk belong to one
+        // of the chunks already received. If so, combine
+        // the messages
+        CheckMessageChunkL( );
+        }
     //TODO: //only for to-path from-path add_header error
     //switch iState = EBody, mode = EError //essentially start looking for end token
     //if mode is error don't issue callbacks, on transition from EndofEndLine,
@@ -558,6 +581,26 @@
     MSRPLOG( "CMSRPMsgParser::HandleHeaderL exit" )
         
     }
+    
+// -----------------------------------------------------------------------------
+// CMSRPMsgParser::HandleOptionalHeaderL
+// -----------------------------------------------------------------------------
+//
+void CMSRPMsgParser::CheckMessageChunkL( )
+    {
+    MSRPLOG( "-> CMSRPMsgParser::HandleHeaderL" )
+    for ( TInt i = 0; i < iIncomingMessageChunks.Count(); i++ )
+        {
+        if ( iMessage->CheckMessageChunkL( *iIncomingMessageChunks[ i ] ) )
+            {
+            delete iMessage;
+            iMessage = iIncomingMessageChunks[ i ];
+            iIncomingMessageChunks.Remove( i );
+            break;
+            }
+        }
+    MSRPLOG( "<- CMSRPMsgParser::HandleHeaderL" )
+    }
 
 // -----------------------------------------------------------------------------
 // CMSRPMsgParser::HandleOptionalHeaderL
@@ -607,12 +650,18 @@
     if(aMatchPos!=0)
         {
         TPtrC8 content(aString.Left(aMatchPos));
-        iMessage->AddContentL(content);       
+        if ( !iMessage->IsTransmissionTerminated() )
+            {
+            MSRPLOG2( "CMSRPMsgParser::HandleBodyL instance = %d", iMessage )
+            iMessage->AddContentL( content, iByteRangeHeaderFound ); 
+            iConnection.ReportReceiveprogressL( iMessage );
+            }
         }
 
     //partial or full match
     if(token.Length())
         {   
+        MSRPLOG( "CMSRPMsgParser::HandleBodyL enter partial/token" )
          
         //if(aMatchPos == 0)
             {
@@ -646,7 +695,7 @@
 //
 void CMSRPMsgParser::HandleEndofEndLineL(const TDesC8& aString, TInt aMatchPos)
     {
-    MSRPLOG( "CMSRPMsgParser::HandleEndofEndLineL enter" )
+    MSRPLOG2( "CMSRPMsgParser::HandleEndofEndLineL enter, char = %d", aString[0] )
     if(aMatchPos != 1)
         User::LeaveIfError(KErrCorrupt);
     
@@ -660,9 +709,23 @@
     else
         User::LeaveIfError(KErrCorrupt);
     
-    iMessage->EndOfMessageL(endType);
-    iConnection.ParseStatusL( iMessage, KErrNone);
-    iMessage = NULL;
+    if ( !iMessage->IsTransmissionTerminated() )
+        {
+        MSRPLOG2( "CMSRPMsgParser::HandleEndofEndLineL instance = %d", iMessage )
+        iMessage->EndOfMessageL( endType );
+        TInt status = iConnection.ParseStatusL( iMessage, KErrNone );
+        if ( endType == MMSRPMessageHandler::EMessageContinues &&
+            status == MMSRPParserObserver::EParseStatusMessageHandled ) 
+            {
+            iIncomingMessageChunks.AppendL( iMessage );
+            }
+        else if ( status == MMSRPParserObserver::EParseStatusError )
+            {
+            delete iMessage;
+            iMessage = NULL;
+            }
+        iMessage = NULL;
+        }
         
     iState = ETitleLine;
     MSRPLOG( "CMSRPMsgParser::HandleEndofEndLineL exit" )    
@@ -709,7 +772,6 @@
     return EFullMatch;    
     }
 
-
 //test cases
 //shyamprasad, prasad, xyz, add, dan, shyamprasad
 //pr, prasad
--- a/Msrp/MsrpServer/src/CMSRPReader.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPReader.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -115,7 +115,7 @@
 //
 void CMSRPReader::RunL()
     {   
-    MSRPLOG( "CMSRPReader::RunL enter" )
+    MSRPLOG2( "CMSRPReader::RunL enter, status = %d", iStatus.Int() )
     Deque();
     CActiveScheduler::Add(this);
     iConnection.ReadStatusL(*iBuf, iStatus.Int());
--- a/Msrp/MsrpServer/src/CMSRPServerSession.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPServerSession.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -122,8 +122,11 @@
 	
 	/* First notify the Server so that connections can be started */
 	iMSRPServer.CreatingSubSessionL( aMessage.Int0() );
+    TBuf8< KMaxLengthOfSessionId > messageId;
+    aMessage.ReadL( 1, messageId );
 	
-	CMSRPServerSubSession* subSession = CMSRPServerSubSession::NewL( *this, iMSRPServer.StateFactory());
+	CMSRPServerSubSession* subSession = CMSRPServerSubSession::NewL( 
+	        *this, iMSRPServer.StateFactory(), messageId );
 	CleanupStack::PushL(subSession);
 			
 	//check handle doesnt preexist or add current time to handle
@@ -175,7 +178,6 @@
 		aMessage.Panic(KBadHandle,EBadSubsessionHandle);		
 		}
     pHandleObj->Subsession()->ServiceL(aMessage);
-    
 	}
 
 
--- a/Msrp/MsrpServer/src/CMSRPServerSubSession.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPServerSubSession.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -24,6 +24,7 @@
 #include "MMSRPConnection.h"
 #include "CMSRPMessageHandler.h"
 #include "CMSRPResponse.h"
+#include "CMSRPReport.h"
 #include "s32mem.h"
 #include "CMSRPMessage.h"
 #include "TStateFactory.h"
@@ -57,7 +58,11 @@
 void CRMessageContainer::Complete(TInt aReason)
     {
     iStatus = FALSE;
-    iMsg.Complete(aReason);    
+    if ( !iMsg.IsNull() )
+        {
+        MSRPLOG("CRMessageContainer::Complete message completed");
+        iMsg.Complete(aReason);    
+        }
     }
 
 TBool CRMessageContainer::Check()
@@ -80,23 +85,29 @@
         }    
     }
 
-CMSRPServerSubSession* CMSRPServerSubSession::NewL( CMSRPServerSession& aServerSession, CStateFactory& aStateFactory )
+CMSRPServerSubSession* CMSRPServerSubSession::NewL( 
+    CMSRPServerSession& aServerSession, 
+    CStateFactory& aStateFactory,
+    const TDesC8& aSessionId )
     {
     CMSRPServerSubSession* self = 
-        CMSRPServerSubSession::NewLC( aServerSession, aStateFactory );
+        CMSRPServerSubSession::NewLC( aServerSession, aStateFactory, aSessionId );
 
     CleanupStack::Pop(self);
     return self;    
     }    
 
 
-CMSRPServerSubSession* CMSRPServerSubSession::NewLC( CMSRPServerSession& aServerSession,CStateFactory& aStateFactory )
+CMSRPServerSubSession* CMSRPServerSubSession::NewLC( 
+    CMSRPServerSession& aServerSession,
+    CStateFactory& aStateFactory,
+    const TDesC8& aSessionId )
     {
     
     CMSRPServerSubSession* self =
                             new (ELeave) CMSRPServerSubSession( aServerSession, aStateFactory );
     CleanupStack::PushL(self);
-    self->ConstructL();
+    self->ConstructL( aSessionId );
     return self;
     }
 
@@ -114,61 +125,43 @@
     
     iState = NULL;         
 
+    QueueLog();
+
     iOutMsgQ.Destroy();
     iInCommingMsgQ.Destroy();
     iPendingSendMsgQ.Destroy();
     iPendingForDeletionQ.Destroy();
-
+    iPendingDataSendCompleteQ.Destroy();
+    iPendingDataIncCompleteQ.Destroy();
+    
     QueueLog();
 
-    if(iCurrentMsgHandler)
-        {
-        delete iCurrentMsgHandler;
-        iCurrentMsgHandler = NULL;
-        }
-    
+    delete iCurrentMsgHandler;
     if(iConnection)
         {
         iConnection->ReleaseConnection(*this);
         iConnection = NULL;
         }
-
-    if(iLocalSessionID)
-        {
-        delete iLocalSessionID;
-        iLocalSessionID = NULL;
-        }
-
-    if( iRemoteSessionID )
-        {
-        delete iRemoteSessionID;
-        iRemoteSessionID = NULL;
-        }
-
-    if( iReceivedResp )
-        {
-        delete iReceivedResp;
-        iReceivedResp = NULL;
-        }
-    if( iReceiveFileMsgHdler )
-        {
-        delete iReceiveFileMsgHdler;
-        iReceiveFileMsgHdler = NULL;
-        }
+    delete iLocalSessionID;
+    delete iRemoteSessionID;
+    delete iReceivedResp;
+    delete iReceiveFileMsgHdler;
 
     MSRPLOG("CMSRPServerSubSession::~CMSRPServerSubSession Exit");
     }
 
 
-void CMSRPServerSubSession::ConstructL( )
+void CMSRPServerSubSession::ConstructL( const TDesC8& aSessionId )
     {
     // Not the place where this should be done!!
     MSRPLOG("CMSRPServerSubSession::ConstructL");  
     iState = iStateFactory.getStateL( EIdle );
-    iLocalSessionID = CreateSubSessionIDL();    
+    iLocalSessionID = HBufC8::NewL( aSessionId.Length() );
+    *iLocalSessionID = aSessionId;    
     }
 
 
+#if 0
 HBufC8* CMSRPServerSubSession::CreateSubSessionIDL( )
     {
     MSRPLOG("CMSRPServerSubSession::CreateSubSessionIDL");
@@ -185,9 +178,10 @@
     CleanupStack::Pop(1);// sessID
     return sessID;
     }
+#endif
 
 
-TBool CMSRPServerSubSession::ProcessEventL( TMSRPFSMEvent aEvent)
+void CMSRPServerSubSession::ProcessEventL( TMSRPFSMEvent aEvent)
     {
     // Call the relevant state. Setup Traps for graceful error propagation to the client.
     MSRPLOG("CMSRPServerSubSession::ProcessEventL() Entered");
@@ -197,11 +191,10 @@
     iState = iState->EventL(aEvent, this); 
     
     MSRPLOG("CMSRPServerSubSession::ProcessEventL() Exit ");
-    return TRUE;
     }
 
 
-TBool CMSRPServerSubSession::ServiceL( const RMessage2& aMessage )
+void CMSRPServerSubSession::ServiceL( const RMessage2& aMessage )
     {
     MSRPLOG("CMSRPServerSubSession::ServiceL()");
 
@@ -210,10 +203,21 @@
     // Getting rid of the switch for translation.
     TMSRPFSMEvent event = (TMSRPFSMEvent) (aMessage.Function() - 2); 
 
-    // Store the incomming aMessage to form the context of the state machine.
+    // Store the incoming aMessage to form the context of the state machine.
     iClientMessage = &aMessage;        
-        
-    return ProcessEventL(event);    
+
+    // let's handle first the special case of EMSRPProgressReportsEvent
+    // that event belongs to subsession
+    if ( event == EMSRPProgressReportsEvent )
+        {
+        iSendProgressReports = aMessage.Int0();
+        CompleteClient( KErrNone );
+        return;
+        }
+    else
+        {
+        ProcessEventL(event);    
+        }
     }
 
 
@@ -232,16 +236,23 @@
 
 TBool CMSRPServerSubSession::MessageReceivedL( CMSRPMessageHandler* aMsg )
     {
-    MSRPLOG("CMSRPServerSubSession::MessageReceivedL - New message received");
-    TBool retVal = FALSE;
-    if(checkMessageForSelfL(aMsg))
-        {           
+    MSRPLOG2("CMSRPServerSubSession::MessageReceivedL - New message received = %d", aMsg);
+    if ( CheckMessageSessionIdL( aMsg ) )
+        {
+        if ( aMsg->IsMessageComplete() )
+            {
+            if ( iCurrentlyReceivingMsgQ.FindElement( aMsg ) )
+                {
+                iCurrentlyReceivingMsgQ.explicitRemove( aMsg );
+                }
+            }
         iReceivedMsg = aMsg;
-        ProcessEventL(EMSRPIncomingMessageReceivedEvent);
-        retVal = TRUE;
+        iReceivedMsg->SetMessageObserver( this );
+        ProcessEventL( EMSRPIncomingMessageReceivedEvent );
+        return ETrue;
         }
-
-    return retVal;    
+        
+    return EFalse;    
     }
 
 
@@ -253,9 +264,24 @@
             aMsg->MessageType() == MMSRPIncomingMessage::EMSRPNotDefined )
             && EFalse == matchSessionIDL(aMsg->GetIncomingMessage()->ToPathHeader()))
         {        
-        TBool sendToClient = aMsg->SendResponseL(this, *iConnection, 
-                CMSRPResponse::ESessionDoesNotExist);          
-        iPendingForDeletionQ.Queue(*aMsg);
+        aMsg->SendResponseL(this, *iConnection, ESessionDoesNotExist );
+        if ( aMsg->IsMessageComplete() )
+            {
+            // no response was needed, must check report also 
+            aMsg->SendReportL( this, *iConnection, ESessionDoesNotExist );        
+            if ( aMsg->IsMessageComplete() )
+                {
+                delete aMsg;
+                }
+            else
+                {
+                iPendingForDeletionQ.Queue(*aMsg);
+                }
+            }
+        else
+            {
+            iPendingForDeletionQ.Queue(*aMsg);
+            }
         }
     else
         {
@@ -263,52 +289,84 @@
         }    
     }
 
-
 // Implementation of interface from MMSRPMsgObserver.
 
-void CMSRPServerSubSession::MessageSendCompleteL()
+void CMSRPServerSubSession::MessageSendCompleteL( CMSRPMessageHandler* aMessageHandler )
     {
     // Called when a message is fully sent out.
-    ProcessEventL(EMSRPDataSendCompleteEvent);
+    iCurrentMsgHandler = aMessageHandler;
+    ProcessEventL( EMSRPDataSendCompleteEvent );
     }
 
 void CMSRPServerSubSession::MessageResponseSendCompleteL(CMSRPMessageHandler& aMsg)
     {
     // Called when a message is fully sent out.
     // Common event handling.
-    iReceivedResp = &aMsg;
-    if(iFileShare)
-        {        
-        ProcessEventL(EMSRPResponseSendCompleteEvent);
+    if ( iPendingForDeletionQ.FindElement( &aMsg ) )
+        {
+        // no need to handle, this message did not belong to this session
+        iPendingForDeletionQ.explicitRemove( &aMsg );
+        delete &aMsg;
+        return;
         }
-        if(iPendingForDeletionQ.explicitRemove(iReceivedResp))
-            {
-            delete iReceivedResp;
-            iReceivedResp = NULL;
-            }
-        
+    iReceivedResp = &aMsg;
+    ProcessEventL( EMSRPResponseSendCompleteEvent );
+    delete iReceivedResp;
+    iReceivedResp = NULL;
+    }
+
+void CMSRPServerSubSession::MessageReportSendCompleteL( CMSRPMessageHandler& aMsg )
+    {
+    if ( iPendingForDeletionQ.FindElement( &aMsg ) )
+        {
+        // no need to handle, this message did not belong to this session
+        iPendingForDeletionQ.explicitRemove( &aMsg );
+        delete &aMsg;
+        return;
+        }
+    iReceivedReport = &aMsg;
+    ProcessEventL( EMSRPReportSendCompleteEvent );
+    delete iReceivedReport;
+    iReceivedReport = NULL;
     }
 
-
-void CMSRPServerSubSession::MessageSendProgressL(TInt aBytesSent, TInt aTotalBytes)
+void CMSRPServerSubSession::MessageSendProgressL( CMSRPMessageHandler* aMessageHandler )
     {
-    iBytesTransferred = aBytesSent;
-    iTotalBytes = aTotalBytes;
-    ProcessEventL(EMSRPSendProgressEvent);    
+    MSRPLOG2( "CMSRPServerSubSession::MessageSendProgressL, instance = %d", aMessageHandler )
+    if ( iSendProgressReports )
+        {
+        iSendProgressMsg = aMessageHandler;
+        ProcessEventL( EMSRPSendProgressEvent );
+        }
     }
 
-
-void CMSRPServerSubSession::MessageReceiveProgressL(TInt aBytesRecvd, TInt aTotalBytes)
+void CMSRPServerSubSession::MessageReceiveProgressL( CMSRPMessageHandler* aMessageHandler )
     {
-    iBytesTransferred = aBytesRecvd;
-    iTotalBytes = aTotalBytes;
-    ProcessEventL(EMSRPReceiveProgressEvent);    
+    MSRPLOG2( "CMSRPServerSubSession::MessageReceiveProgressL, instance = %d", aMessageHandler )
+    if ( iSendProgressReports )
+        {
+        if ( CheckMessageSessionIdL( aMessageHandler ) )
+            {
+            if ( !iCurrentlyReceivingMsgQ.FindElement( aMessageHandler ) )
+                {
+                iCurrentlyReceivingMsgQ.Queue( *aMessageHandler );
+                }
+            iReceiveProgressMsg = aMessageHandler;
+            ProcessEventL( EMSRPReceiveProgressEvent );
+            }
+        }
     }
 
+void CMSRPServerSubSession::MessageCancelledL( )
+    {
+    MSRPLOG( "CMSRPServerSubSession::MessageCancelledL enter" )
+    ProcessEventL( EMSRPDataCancelledEvent );
+    MSRPLOG( "CMSRPServerSubSession::MessageCancelledL exit" )
+    }
 
 void CMSRPServerSubSession::WriterError()
     {
-    
+    MSRPLOG( "CMSRPServerSubSession::WriterError!!" )
     }
 
 
@@ -347,78 +405,70 @@
     }
 
 
-void CMSRPServerSubSession::NotifyFileReceiveResultToClientL(CMSRPMessageHandler */*msgHandler*/)
-    {
-    //TODO
-    MSRPLOG("CMSRPServerSubSession::NotifyFileReceiveResultToClientL enter");
-    iSendResultListenMSRPDataPckg().iStatus = 200;
-    iSendResultListenMSRPDataPckg().iIsProgress = FALSE;
-    iResponseListner.Write(0,iSendResultListenMSRPDataPckg);
-    iResponseListner.Complete( KErrNone );
-    MSRPLOG("CMSRPServerSubSession::NotifyFileReceiveResultToClientL exit");
-    }
-
-
-void CMSRPServerSubSession::NotifyFileSendResultToClientL(CMSRPMessageHandler */*msgHandler*/)
+void CMSRPServerSubSession::SendProgressToClientL( CMSRPMessageHandler* aMessageHandler )
     {
-    //TODO
-    MSRPLOG("CMSRPServerSubSession::NotifyFileSendResultToClientL enter");
-    iSendResultListenMSRPDataPckg().iStatus = 200;
-    iSendResultListenMSRPDataPckg().iIsProgress = FALSE;
-    iResponseListner.Write(0,iSendResultListenMSRPDataPckg);
-    iResponseListner.Complete( KErrNone );
-    MSRPLOG("CMSRPServerSubSession::NotifyFileSendResultToClientL exit");
-    }
-
-
-TBool CMSRPServerSubSession::SendProgressToClientL(CMSRPMessageHandler */*msgHandler*/)
-    {
-    MSRPLOG("CMSRPServerSubSession::SendProgressToClientL enter");
-    iSendResultListenMSRPDataPckg().iStatus    = KErrNone;
+    MSRPLOG2("CMSRPServerSubSession::SendProgressToClientL enter, instance = %d", aMessageHandler );
+    TInt bytesTransferred;
+    TInt totalBytes;
+    aMessageHandler->CurrentSendProgress( bytesTransferred, totalBytes );
+    MSRPLOG2( "CMSRPServerSubSession::SendProgressToClientL, bytesr = %d", bytesTransferred )
+    MSRPLOG2( "CMSRPServerSubSession::SendProgressToClientL, total = %d", totalBytes )
+    HBufC8* messageId = aMessageHandler->MessageIdLC();
+    iSendResultListenMSRPDataPckg().iStatus = EAllOk;
     iSendResultListenMSRPDataPckg().iIsProgress = TRUE;
-    iSendResultListenMSRPDataPckg().iBytesSent = iBytesTransferred;
-    iSendResultListenMSRPDataPckg().iTotalBytes = iTotalBytes;
-    
+    iSendResultListenMSRPDataPckg().iBytesSent = bytesTransferred;
+    iSendResultListenMSRPDataPckg().iTotalBytes = totalBytes;
+    if ( messageId->Length() < KMaxLengthOfSessionId )
+        {
+        iSendResultListenMSRPDataPckg().iMessageId = *messageId;
+        }
+    CleanupStack::PopAndDestroy(); // messageId
     iResponseListner.Write(0,iSendResultListenMSRPDataPckg);
     iResponseListner.Complete( KErrNone );
 
     MSRPLOG("CMSRPServerSubSession::SendProgressToClientL exit");
-    return TRUE;
     }
 
 
-TBool CMSRPServerSubSession::ReceiveProgressToClientL(CMSRPMessageHandler */*msgHandler*/)
+void CMSRPServerSubSession::ReceiveProgressToClientL( CMSRPMessageHandler* aMessageHandler )
     {
-    MSRPLOG("CMSRPServerSubSession::ReceiveProgressToClientL enter");
+    MSRPLOG2("CMSRPServerSubSession::ReceiveProgressToClientL enter, instance = %d", aMessageHandler );
+    TInt bytesReceived;
+    TInt totalBytes;
+    aMessageHandler->CurrentReceiveProgress( bytesReceived, totalBytes );
+    MSRPLOG2( "CMSRPServerSubSession::ReceiveProgressToClientL, bytesr = %d", bytesReceived )
+    MSRPLOG2( "CMSRPServerSubSession::ReceiveProgressToClientL, total = %d", totalBytes )
+    HBufC8* messageId = aMessageHandler->MessageIdLC();
     iListenMSRPdataPckg().iStatus    = KErrNone;
     iListenMSRPdataPckg().iIsProgress = TRUE;
-    iListenMSRPdataPckg().iBytesRecvd = iBytesTransferred;
-    iListenMSRPdataPckg().iTotalBytes = iTotalBytes;
-    
+    iListenMSRPdataPckg().iBytesRecvd = bytesReceived;
+    iListenMSRPdataPckg().iTotalBytes = totalBytes;
+    if ( messageId->Length() < KMaxLengthOfSessionId )
+        {
+        iListenMSRPdataPckg().iMessageId = *messageId;
+        }
+    CleanupStack::PopAndDestroy(); // messageId
     iIncommingMessageListner.Write(0,iListenMSRPdataPckg);
     iIncommingMessageListner.Complete( KErrNone );
     MSRPLOG("CMSRPServerSubSession::ReceiveProgressToClientL exit");
-    return TRUE;
     }
 
 
-TBool CMSRPServerSubSession::sendResultToClientL(CMSRPMessageHandler *msgHandler)
+void CMSRPServerSubSession::sendResultToClientL(CMSRPMessageHandler *msgHandler)
     {
     MSRPLOG("CMSRPServerSubSession::sendResultToClientL");
     HBufC8* messageId = NULL;
-    TUint i=0;
 
     // Allocates memory.
-    TBool error = msgHandler->GetSendResultL( i, messageId );            
+    TUint errorCode = msgHandler->GetSendResultL( messageId );            
 
     iSendResultListenMSRPDataPckg().iIsProgress = FALSE;
     iSendResultListenMSRPDataPckg().iMessageId = *messageId;
-    iSendResultListenMSRPDataPckg().iStatus    = i;
+    iSendResultListenMSRPDataPckg().iStatus = errorCode;
     iResponseListner.Write(0,iSendResultListenMSRPDataPckg);
 
     delete messageId;
     iResponseListner.Complete( KErrNone );
-    return error;
     }
 
 
@@ -429,32 +479,77 @@
     MSRPLOG("CMSRPServerSubSession::sendMsgToClientL");
     CMSRPMessage* inMsg = incommingMsgHandler->GetIncomingMessage();
 
-    CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256
-    CleanupStack::PushL( buf1 );
-    RBufWriteStream writeStream( *buf1 );
-    CleanupClosePushL( writeStream );
-
-    inMsg->ExternalizeL( writeStream );
-    writeStream.CommitL();
-
-    iListenMSRPdataPckg().iIsProgress = FALSE;
-    if ( buf1->Size() > KMaxLengthOfIncomingMessageExt )
+    if ( inMsg )
         {
-        // invalid message size
-        iListenMSRPdataPckg().iStatus = KErrArgument;
-        }
-    else
-        {
-        buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() );
-            iListenMSRPdataPckg().iStatus = KErrNone;            
+        CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256
+        CleanupStack::PushL( buf1 );
+        RBufWriteStream writeStream( *buf1 );
+        CleanupClosePushL( writeStream );
+    
+        inMsg->ExternalizeL( writeStream );
+        writeStream.CommitL();
+    
+        iListenMSRPdataPckg().iIsProgress = FALSE;
+        if ( buf1->Size() > KMaxLengthOfIncomingMessageExt )
+            {
+            // invalid message size
+            iListenMSRPdataPckg().iStatus = KErrArgument;
+            }
+        else
+            {
+            buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() );
+                iListenMSRPdataPckg().iStatus = KErrNone;            
+            }
+    
+        CleanupStack::PopAndDestroy(2); // buf1, writestream    
+       
+        iIncommingMessageListner.Write(0,iListenMSRPdataPckg);
+        iIncommingMessageListner.Complete(KErrNone);    
+    
+        return ETrue;
         }
+        
+    return EFalse;
+    }
 
-    CleanupStack::PopAndDestroy(2); // buf1, writestream    
-   
-    iIncommingMessageListner.Write(0,iListenMSRPdataPckg);
-    iIncommingMessageListner.Complete(KErrNone);    
+TBool CMSRPServerSubSession::sendReportToClientL( CMSRPMessageHandler *incommingMsgHandler )
+    {
+    // Use the client send result listner to respond.
+    // Extract the data and complete the iIncommingMessageListner.
+    MSRPLOG("CMSRPServerSubSession::sendReportToClientL");
+    CMSRPReport* inMsg = incommingMsgHandler->GetIncomingReport();
 
-    return TRUE;
+    if ( inMsg )
+        {
+        CBufSeg* buf1 = CBufSeg::NewL( 256 ); // expandsize 256
+        CleanupStack::PushL( buf1 );
+        RBufWriteStream writeStream( *buf1 );
+        CleanupClosePushL( writeStream );
+    
+        inMsg->ExternalizeL( writeStream );
+        writeStream.CommitL();
+    
+        iListenMSRPdataPckg().iIsProgress = FALSE;
+        if ( buf1->Size() > KMaxLengthOfIncomingMessageExt )
+            {
+            // invalid message size
+            iListenMSRPdataPckg().iStatus = KErrArgument;
+            }
+        else
+            {
+            buf1->Read( 0, iListenMSRPdataPckg().iExtMessageBuffer, buf1->Size() );
+                iListenMSRPdataPckg().iStatus = KErrNone;            
+            }
+    
+        CleanupStack::PopAndDestroy(2); // buf1, writestream    
+       
+        iIncommingMessageListner.Write(0,iListenMSRPdataPckg);
+        iIncommingMessageListner.Complete(KErrNone);    
+    
+        return ETrue;
+        }
+        
+    return EFalse;
     }
 
 void CMSRPServerSubSession::ReadSendDataPckgL()
@@ -465,33 +560,66 @@
 
 TBool CMSRPServerSubSession::listnerSetupComplete()
     {
-    if(iIncommingMessageListner.Check() && iResponseListner.Check())
-        return TRUE;
+    if( iIncommingMessageListner.Check() && iResponseListner.Check() )
+        {
+        return ETrue;
+        }
     
-    return FALSE;        
+    return EFalse;        
     }
 
 CMSRPServerSubSession::TQueueType CMSRPServerSubSession::getQToProcess()
     {
-    // Check the pending incomming message queue and client request queue and
-    // decides which to process.
-    // The longer queue is given a priority. If queues are equal incomming message queue 
-    // is given priority.
+    // Priority 0, progress reports
+    if ( iPendingSendProgressQ.Length( ) )
+        {
+        return TSendProgressQueue;
+        }
+    if ( iPendingReceiveProgressQ.Length( ) )
+        {
+        return TReceiveProgressQueue;
+        }
+    
+    // priority 1, completed send messages
+    if ( iPendingDataSendCompleteQ.Length() )
+        {
+        return TCompletedSendQueue;
+        }
 
-    if(iPendingSendMsgQ.Length() > iInCommingMsgQ.Length())
+    // priority 2, completed receive message
+    if ( iPendingDataIncCompleteQ.Length() )
+        {
+        return TCompletedIncQueue;
+        }
+
+    // priority 3, incoming messages and client requests
+    if( iPendingSendMsgQ.Length() > iInCommingMsgQ.Length() )
+        {
         return TClientQueue;
+        }
     else
-        return TInCommingMsgQueue;        
+        {
+        return TInCommingMsgQueue;
+        }
     }
 
 
 TBool CMSRPServerSubSession::QueuesEmpty()
     {
     // Returns TRUE if there are no messages to process.
-    if(iPendingSendMsgQ.isEmpty() && iInCommingMsgQ.isEmpty())
-        return TRUE;
+    if( iPendingSendProgressQ.isEmpty() &&
+        iPendingReceiveProgressQ.isEmpty() &&
+        iPendingDataSendCompleteQ.isEmpty() &&
+        iPendingDataIncCompleteQ.isEmpty() &&
+        iPendingSendMsgQ.isEmpty() && 
+        iInCommingMsgQ.isEmpty() )
+        {
+        return ETrue;
+        }
     else
-        return FALSE;
+        {
+        return EFalse;
+        }
     }
 
 TBool CMSRPServerSubSession::informConnectionReadyToClient()
@@ -515,7 +643,9 @@
 void CMSRPServerSubSession::QueueLog()
     {
     if(iOutMsgQ.Length() || iInCommingMsgQ.Length() || iPendingSendMsgQ.Length()||
-        iPendingForDeletionQ.Length())
+        iPendingForDeletionQ.Length() || iPendingDataSendCompleteQ.Length() ||
+        iPendingDataIncCompleteQ.Length() || iPendingSendProgressQ.Length() || 
+        iPendingReceiveProgressQ.Length() )
         {
         // If any of the Queue is not empty. Log a event.
         MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iOutMsgQ       %d",
@@ -529,6 +659,18 @@
 
         MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingForDeletionQ %d",
                     iPendingForDeletionQ.Length());
+
+        MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingDataSendCompleteQ %d",
+                iPendingDataSendCompleteQ.Length());
+
+        MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingDataIncCompleteQ %d",
+                iPendingDataIncCompleteQ.Length());
+
+        MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingSendProgressQ %d",
+                iPendingSendProgressQ.Length() );
+
+        MSRPLOG2("CMSRPServerSubSession::ProcessEventL() Queue iPendingReceiveProgressQ %d",
+                iPendingReceiveProgressQ.Length() );
         }
     else
         {
@@ -537,40 +679,56 @@
     }
 
 
-TBool CMSRPServerSubSession::checkMessageForSelfL(CMSRPMessageHandler *aMsgHandler)
+// -----------------------------------------------------------------------------
+// CMSRPServerSubSession::CheckMessageSessionIdL
+// -----------------------------------------------------------------------------
+//
+TBool CMSRPServerSubSession::CheckMessageSessionIdL( CMSRPMessageHandler *aMsgHandler )
     {
-    MSRPLOG("CMSRPServerSubSession::checkMessageForSelfL");
+    MSRPLOG( "-> CMSRPServerSubSession::CheckMessageSessionIdL" );
     CMSRPMessageBase *message = aMsgHandler->GetIncomingResponse();
     if(!message)
         { 
         message = aMsgHandler->GetIncomingMessage();
         }
     
-    if(!message)
-        return FALSE;
+    if( !message )
+        {
+        message = aMsgHandler->GetIncomingReport();
+        }
+  
+    if( !message )
+        {
+        return EFalse; 
+        }
 
     // Check if the sessionID in the 'To' path matches the LocalSessionID.
-    if(FALSE == matchSessionIDL(message->ToPathHeader()))
-        return FALSE;
-
-    // Check if the sessionID in the 'From' path matches the known RemoteSessionID.
-    return matchSessionIDL(message->FromPathHeader(), FALSE);            
+    if( !matchSessionIDL(message->ToPathHeader()) ||
+            !matchSessionIDL(message->FromPathHeader(), EFalse ) )
+        {
+        return EFalse;
+        }
+        
+    return ETrue;
     }
-
-
+    
 TBool CMSRPServerSubSession::matchSessionIDL(const CMSRPHeaderBase *aPathHeader, TBool local)
     {
-    TBool retVal = FALSE;
+    TBool retVal( EFalse );
     
     HBufC8* textValue = aPathHeader->ToTextValueLC();        
     TPtrC8 receivedSessionID = extractSessionID(*textValue);    
     
     if(local && receivedSessionID  == *iLocalSessionID)
-        retVal =  TRUE;
+        {
+        retVal =  ETrue;
+        }
 
     
     if(!local && receivedSessionID == *iRemoteSessionID)
-        retVal =  TRUE;
+        {
+        retVal =  ETrue;
+        }
 
     CleanupStack::PopAndDestroy(textValue);
 
--- a/Msrp/MsrpServer/src/CMSRPWriter.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/CMSRPWriter.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -104,6 +104,16 @@
 void CMSRPWriter::RequestSendL(MMSRPWriterObserver& aMsg)
     { 
     MSRPLOG( "CMSRPWriter::RequestSendL enter" )
+    // making sure the msg is not already in queue
+    for ( TInt i = 0; i < iSendQueue.Count(); i++ )
+        {
+        if ( iSendQueue[ i ] == &aMsg )
+            {
+            // already included
+            return;
+            }
+        }
+    
     iSendQueue.AppendL(&aMsg);
     if(!IsActive())
         {
@@ -117,6 +127,26 @@
     }
 
 // -----------------------------------------------------------------------------
+// CMSRPWriter::CancelSendingL
+// -----------------------------------------------------------------------------
+//
+void CMSRPWriter::CancelSendingL( const MMSRPWriterObserver* aMsg )
+    {
+    MSRPLOG( "CMSRPWriter::CancelSendingL enter" )
+    if ( iSendQueue.Count() )
+        {
+        if ( iSendQueue[ 0 ] == aMsg )
+            {
+            if( iWriteIssued )
+                {
+                MSRPLOG( "CMSRPWriter::CancelSendingL Write Canceled" )
+                iSocket.CancelWrite();      
+                }
+            }
+        }
+    }   
+
+// -----------------------------------------------------------------------------
 // CMSRPWriter::CancelReceiving
 // -----------------------------------------------------------------------------
 //
@@ -149,7 +179,8 @@
         MMSRPWriterObserver::TMsgStatus msgState = MMSRPWriterObserver::EComplete;
         msgState = iSendQueue[0]->WriteDoneL(status); 
         
-        if(msgState != MMSRPWriterObserver::EPending)
+        if( msgState != MMSRPWriterObserver::EPending && 
+                msgState != MMSRPWriterObserver::ESendingReport )    
             {
             MMSRPWriterObserver* obs = iSendQueue[0];
             iSendQueue.Remove(0);
@@ -186,16 +217,14 @@
     {
     TBool interruptSend = FALSE;
 
-    //while(iSendQueue.Count())
     if(iSendQueue.Count())        
         {
         MMSRPWriterObserver::TWriteStatus ret = MMSRPWriterObserver::EMsrpSocketWrite;
-        TPtrC8 data(NULL,0);
         
         if(iSendQueue.Count()>1)
             interruptSend = TRUE;
         
-        ret = iSendQueue[0]->GetSendBufferL(data, interruptSend);
+        const TDesC8& writeBuffer = iSendQueue[0]->GetSendBufferL( ret, interruptSend);
         
         Deque();
         CActiveScheduler::Add(this);
@@ -203,7 +232,7 @@
 
         if( ret == MMSRPWriterObserver::EMsrpSocketWrite ) //KErrNone == 0
            {
-           iSocket.Write( data, iStatus );
+           iSocket.Write( writeBuffer, iStatus );
            iWriteIssued = TRUE;           
            }   
         else if (ret == MMSRPWriterObserver::EMsrpAvoidSocketWrite)//EAvoidSocketWrite
--- a/Msrp/MsrpServer/src/TStateFactory.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/TStateFactory.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -15,6 +15,7 @@
 */
 
 #include "TStateFactory.h"
+#include "msrpcommon.h"
 
 #define ADD_STATE_TO_ARRAY(state) \
     {\
@@ -25,6 +26,7 @@
 
 CStateFactory* CStateFactory::NewL()
     {
+    MSRPLOG( "-> CStateFactory::NewL")
     CStateFactory* factory = CStateFactory::NewLC();
     CleanupStack::Pop( factory );       
     return factory;
@@ -32,14 +34,17 @@
 
 CStateFactory* CStateFactory::NewLC()
     {
+    MSRPLOG( "-> CStateFactory::NewLC")
     CStateFactory* factory = new ( ELeave ) CStateFactory;
     CleanupStack::PushL( factory );
     factory->ConstructL();
+    MSRPLOG( "<- CStateFactory::NewLC")
     return factory;       
     }
 
 void CStateFactory::ConstructL( )
     {
+    MSRPLOG( "-> CStateFactory::ConstructL")
     TStateBase *state;
 
     state = new ( ELeave ) TStateIdle;
@@ -54,14 +59,9 @@
     state = new ( ELeave ) TStateActive;
     ADD_STATE_TO_ARRAY( state );
 
-    state = new ( ELeave ) TStateActiveSend;
-    ADD_STATE_TO_ARRAY( state ); 
-	
-	state = new ( ELeave ) TStateFileShare;
-    ADD_STATE_TO_ARRAY( state ); 
-    
     state = new ( ELeave ) TStateError;
     ADD_STATE_TO_ARRAY( state );  
+    MSRPLOG( "<- CStateFactory::ConstructL")
     }
 
 CStateFactory::CStateFactory()
--- a/Msrp/MsrpServer/src/TStates.cpp	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/MsrpServer/src/TStates.cpp	Thu Nov 25 13:59:42 2010 +0200
@@ -40,35 +40,6 @@
     return aContext->StateFactory().getStateL(EIdle);
     }  
 
-TStateBase * TStateFileShare::processIncommingMessageL(CMSRPServerSubSession *aContext, 
-                 CMSRPMessageHandler* incommingMsg)
-    {
-    MSRPLOG("TStateFileShare::processIncommingMessage Enter!");
-    TStateBase *state = this;
-    CMSRPMessageHandler *incommingMsgHandler;
-    if(NULL != incommingMsg)
-        {
-        aContext->iInCommingMsgQ.Queue(*incommingMsg);
-        }
-    incommingMsgHandler = aContext->iInCommingMsgQ.DeQueue();         
- 
-    while (incommingMsgHandler && state == this)
-        {
-        if(MMSRPIncomingMessage::EMSRPResponse == incommingMsgHandler->MessageType())
-            {
-            state = handlesResponseL(aContext,incommingMsgHandler);                    
-            }
-        else
-            {
-            state = handleRequestsL(aContext,incommingMsgHandler);
-            }
-        incommingMsgHandler = aContext->iInCommingMsgQ.DeQueue();
-        }
-      
-    MSRPLOG("TStateFileShare::processIncommingMessage Exit!");
-    return state;
-    }
- 
 TStateBase* TStateBase::processIncommingMessageL(CMSRPServerSubSession *aContext, 
                  CMSRPMessageHandler* incommingMsg)
     {
@@ -89,6 +60,10 @@
             {
             return handlesResponseL(aContext,incommingMsgHandler);                    
             }
+        if( MMSRPIncomingMessage::EMSRPReport == incommingMsgHandler->MessageType( ) )
+            {
+            return handleRequestsL( aContext,incommingMsgHandler );
+            }
         else
             {
             return handleRequestsL(aContext,incommingMsgHandler);
@@ -105,12 +80,74 @@
      
     msgHandler = aContext->iPendingSendMsgQ.DeQueue();
     msgHandler->SendMessageL(*aContext->iConnection);
+    aContext->iOutMsgQ.Queue( *msgHandler );
+    return aContext->StateFactory().getStateL( EActive );
+    }
     
-    // Shift this to Outgoing Queue.
-    aContext->iCurrentMsgHandler = msgHandler;
-    return aContext->StateFactory().getStateL(EActiveSend);
+TStateBase* TStateBase::processCompletedMessageL( CMSRPServerSubSession *aContext )
+    {
+    MSRPLOG("TStateBase::processCompletedMessageL Entered!");
+    CMSRPMessageHandler* msgHandler = aContext->iPendingDataSendCompleteQ.DeQueue();
+    
+    if ( msgHandler->IsTransmissionTerminated() )
+        {
+        MSRPLOG("TStateBase::processCompletedMessageL transmission terminated");
+        if( aContext->iResponseListner.Check() )
+            {
+            MSRPLOG("TStateBase::processCompletedMessageL complete with KErrCancel");    
+            aContext->iResponseListner.Complete( KErrCancel );
+            }
+        }
+    else
+        {
+        aContext->sendResultToClientL( msgHandler );      
+        }
+
+    delete msgHandler;
+    return aContext->StateFactory().getStateL( EWaitForClient );
+    }
+    
+TStateBase* TStateBase::processCompletedIncomingMessageL( CMSRPServerSubSession *aContext )
+    {
+    MSRPLOG("TStateBase::processCompletedIncomingMessageL Entered!");
+    CMSRPMessageHandler* msgHandler = aContext->iPendingDataIncCompleteQ.DeQueue();
+    
+    if ( msgHandler->IsTransmissionTerminated() )
+        {
+        MSRPLOG("TStateBase::processCompletedIncomingMessageL transmission terminated");
+        if( aContext->iIncommingMessageListner.Check() )
+            {
+            MSRPLOG("TStateBase::processCompletedIncomingMessageL complete with KErrCancel");    
+            aContext->iIncommingMessageListner.Complete( KErrCancel );
+            }
+        }
+    else
+        {
+        aContext->sendMsgToClientL( msgHandler );      
+        delete msgHandler;
+        }
+        
+    return aContext->StateFactory().getStateL( EWaitForClient );
     }
  
+TStateBase* TStateBase::processReceiveReportL( CMSRPServerSubSession *aContext )
+    {
+    MSRPLOG("TStateBase::processReceiveReportL Entered!");
+    CMSRPMessageHandler* msgHandler = aContext->iPendingReceiveProgressQ.DeQueue();
+
+    aContext->ReceiveProgressToClientL( msgHandler );
+    return aContext->StateFactory().getStateL( EWaitForClient );
+    }
+    
+TStateBase* TStateBase::processSendReportL( CMSRPServerSubSession *aContext )
+    {
+    MSRPLOG("TStateBase::processSendReportL Entered!");
+    CMSRPMessageHandler* msgHandler = aContext->iPendingSendProgressQ.DeQueue();
+
+    aContext->SendProgressToClientL( msgHandler );
+    return aContext->StateFactory().getStateL( EWaitForClient );
+    }
+
 TStateBase* TStateBase::handlesResponseL(CMSRPServerSubSession *aContext,
                  CMSRPMessageHandler *incommingMsgHandler)
     {
@@ -130,30 +167,26 @@
         }
     else
         {
-        TBool error = 0;
-        CleanupStack::PushL(incommingMsgHandler);
-        TBool sendResult = outgoingMsgHandler->ConsumeResponseL(*incommingMsgHandler);
+        CleanupStack::PushL( incommingMsgHandler );
+        TUint responseCode = outgoingMsgHandler->ConsumeResponseL( *incommingMsgHandler );
          
-        if( sendResult )
+        if( outgoingMsgHandler->IsMessageComplete() ||
+            responseCode != EAllOk ||
+            ( outgoingMsgHandler->IsFailureHeaderPartial() &&
+              responseCode != EAllOk ) )
             {
-            error = aContext->sendResultToClientL(outgoingMsgHandler);
-            }        
-         
-        if(outgoingMsgHandler->IsMessageComplete())
+            aContext->iConnection->CancelSendingL( outgoingMsgHandler );
+            aContext->sendResultToClientL( outgoingMsgHandler );
+            aContext->iOutMsgQ.explicitRemove( outgoingMsgHandler );    
+            delete outgoingMsgHandler;
+            }
+        else
             {
-            aContext->iOutMsgQ.explicitRemove(outgoingMsgHandler);    
-            delete outgoingMsgHandler;
+            aContext->iConnection->ContinueSendingL( *outgoingMsgHandler );
             }
                  
         CleanupStack::Pop(incommingMsgHandler); 
-        if( error )
-            {
-            nextState = aContext->StateFactory().getStateL(EError);   
-            }
-        else
-            {
-            nextState = aContext->StateFactory().getStateL(EWaitForClient);     
-            }            
+        nextState = aContext->StateFactory().getStateL(EWaitForClient);     
         }
     
     delete incommingMsgHandler;    
@@ -165,61 +198,100 @@
 TStateBase* TStateBase::handleRequestsL(CMSRPServerSubSession *aContext,
                  CMSRPMessageHandler *incommingMsgHandler)
     {
+    MSRPLOG("-> TStateBase::handleRequestsL");
     MMSRPIncomingMessage::TMSRPMessageType msgType = incommingMsgHandler->MessageType();
     
     if(MMSRPIncomingMessage::EMSRPMessage == msgType) // SEND request
         {
         MSRPLOG("SEND request received");
-        TBool sendToClient = incommingMsgHandler->SendResponseL(aContext, 
-                *aContext->iConnection, 0);        
-        if(sendToClient)
+        incommingMsgHandler->SendResponseL(aContext, *aContext->iConnection, EAllOk );        
+        incommingMsgHandler->SendReportL(aContext, *aContext->iConnection, EAllOk );        
+        if( incommingMsgHandler->IsMessageComplete() )
             {
+            MSRPLOG("-> TStateBase::handleRequestsL complete");
             aContext->sendMsgToClientL(incommingMsgHandler);
+            delete incommingMsgHandler;
+            //aContext->iPendingForDeletionQ.Queue(*incommingMsgHandler);
+            return aContext->StateFactory().getStateL(EWaitForClient);
             }
-        aContext->iPendingForDeletionQ.Queue(*incommingMsgHandler);
-        return aContext->StateFactory().getStateL(EWaitForClient);
+        return aContext->StateFactory().getStateL( EActive );
         }
     else if(MMSRPIncomingMessage::EMSRPReport == msgType) // Drop Reports
         {
-        MSRPLOG("Reports not supported!!");
+        aContext->sendMsgToClientL( incommingMsgHandler );
         delete incommingMsgHandler;
-        return this;
+        //aContext->iPendingForDeletionQ.Queue(*incommingMsgHandler);
+        return aContext->StateFactory().getStateL( EWaitForClient );
         }
     else // It is an unrecognized request eg. AUTH
         {
         MSRPLOG("Unrecognized request received");
-        TBool sendToClient = incommingMsgHandler->SendResponseL(aContext, 
-                *aContext->iConnection, CMSRPResponse::EUnknownRequestMethod);        
+        incommingMsgHandler->SendResponseL(aContext, *aContext->iConnection, EUnknownRequestMethod );        
         aContext->iPendingForDeletionQ.Queue(*incommingMsgHandler);
         return aContext->StateFactory().getStateL(EWaitForClient);
         }
     } 
- 
-TStateBase* TStateBase::handleClientListnerCancelL(CMSRPServerSubSession * aContext, 
+    
+TStateBase* TStateBase::handleClientListnerCancelL( CMSRPServerSubSession* aContext, 
         TMSRPFSMEvent aEvent)
     {
+    MSRPLOG("-> TStateBase::handleClientListnerCancelL");
     if(aEvent == EMSRPCancelReceivingEvent)
         {
-        // Confirm completion of the Cancel Request.
-        aContext->CompleteClient(KErrNone);
+        // let's find the correct listener first
+        TBuf8< KMaxLengthOfTransactionIdString > messageId;
+        aContext->iClientMessage->ReadL( 0, messageId );
+        // going through all incoming instances
+        CMSRPMessageHandler* owner = aContext->iCurrentlyReceivingMsgQ.FindElement( messageId );
+        if ( owner )
+            {
+            MSRPLOG2("TStateBase::handleClientListnerCancelL terminating %d", owner );
+            owner->TerminateReceiving( aContext, *aContext->iConnection );
+            }
+        else
+            {
+            if( aContext->iIncommingMessageListner.Check() )
+                {
+                aContext->iIncommingMessageListner.Complete( KErrNone );
+                }
+            }
         
-        // Complete the Listner if that is active.
-        if(aContext->iIncommingMessageListner.Check())
-            aContext->iIncommingMessageListner.Complete(KErrNone);
+        // Confirm completion of the Cancel Request.
+        aContext->CompleteClient( KErrNone );
         }    
     
     if(aEvent == EMSRPCancelSendRespListeningEvent)
         {
         // Confirm completion of the Cancel Request.
-        aContext->CompleteClient(KErrNone);
+        aContext->CompleteClient( KErrNone );
         
         // Complete the Listner if that is active.
         if(aContext->iResponseListner.Check())
-            aContext->iResponseListner.Complete(KErrNone);        
+            aContext->iResponseListner.Complete( KErrNone );        
         }
     
     return aContext->StateFactory().getStateL(EWaitForClient);    
     }
+    
+TStateBase* TStateBase::HandleClientCancelSendingL( CMSRPServerSubSession* aContext )
+    {
+    MSRPLOG("-> TStateBase::HandleClientCancelSendingL");
+    // let's find the correct listener first
+    TBuf8< KMaxLengthOfTransactionIdString > messageId;
+    aContext->iClientMessage->ReadL( 0, messageId );
+    
+    // going through all incoming instances
+    CMSRPMessageHandler* owner = aContext->iOutMsgQ.FindElement( messageId );
+    if ( owner )
+        {
+        MSRPLOG2("TStateBase::HandleClientCancelSendingL terminating %d", owner );
+        owner->TerminateSending( );
+        }
+    
+    // Confirm completion of the Cancel Request.
+    aContext->CompleteClient( KErrNone );
+    return this;
+    }
   
 TStateBase* TStateBase::handleConnectionStateChangedL(CMSRPServerSubSession *aContext)
     {
@@ -321,16 +393,85 @@
         }
     else
         {   
-        if( CMSRPServerSubSession::TInCommingMsgQueue == 
-                           aContext->getQToProcess() )
-            state  =  processIncommingMessageL( aContext );       
+        CMSRPServerSubSession::TQueueType type = aContext->getQToProcess();
+        if ( type == CMSRPServerSubSession::TReceiveProgressQueue )
+            {
+            state  =  processReceiveReportL( aContext );       
+            }
+        else if ( type == CMSRPServerSubSession::TSendProgressQueue )
+            {
+            state  =  processSendReportL( aContext );       
+            }
+        else if ( type == CMSRPServerSubSession::TCompletedSendQueue )
+            {
+            state  =  processCompletedMessageL( aContext );       
+            }
+        else if ( type == CMSRPServerSubSession::TCompletedIncQueue )
+            {
+            state  =  processCompletedIncomingMessageL( aContext );       
+            }
+        else if( type == CMSRPServerSubSession::TInCommingMsgQueue )
+            {
+            state  =  processIncommingMessageL( aContext );
+            }
         else
+            {
             state  =  processPendingMessageQL( aContext );
+            }
         }   
 
     return state;
     }
 
+TStateBase* TStateBase::handleInCommingMessagesL(CMSRPServerSubSession *aContext)
+     {
+     CMSRPMessageHandler* incommingMsg = aContext->iReceivedMsg;
+     aContext->iReceivedMsg = NULL;
+     
+     return processIncommingMessageL(aContext, incommingMsg);             
+     }
+
+TStateBase* TStateBase::MessageSendCompleteL(CMSRPServerSubSession *aContext)
+    {
+    // Handle send message complete event.
+    if( NULL == aContext->iCurrentMsgHandler)
+        {
+        MSRPLOG( "TStateBase::MessageSendCompleteL :: iCurrentMsgHandler is NULL \n" );                                     
+        return this;
+        }
+        
+    if ( aContext->iCurrentMsgHandler->IsTransmissionTerminated() )
+        {
+        MSRPLOG("TStateBase::processCompletedMessageL transmission terminated");
+        if( aContext->iResponseListner.Check() )
+            {
+            MSRPLOG("TStateBase::processCompletedMessageL complete with KErrCancel");    
+            aContext->iResponseListner.Complete( KErrCancel );
+            }
+        return aContext->StateFactory().getStateL( EWaitForClient );
+        }
+        
+    if( aContext->iCurrentMsgHandler->IsMessageComplete() )
+        {
+        // Messages with Failure Report set to "No" will never get a response.        
+        aContext->sendResultToClientL( aContext->iCurrentMsgHandler );      
+        CMSRPMessageHandler* temp = aContext->iOutMsgQ.getMatch( aContext->iCurrentMsgHandler );
+        if ( temp )
+            {
+            aContext->iOutMsgQ.explicitRemove( aContext->iCurrentMsgHandler );
+            }
+        delete aContext->iCurrentMsgHandler;
+        aContext->iCurrentMsgHandler = NULL;
+        return aContext->StateFactory().getStateL( EWaitForClient );
+        }
+    else
+        {
+        aContext->iCurrentMsgHandler = NULL;
+        // Handle any pending events in Queue.
+        return handleQueuesL(aContext);     
+        }
+    }
+
 TStates TStateIdle::identity()
     {
     return EIdle;
@@ -414,7 +555,6 @@
     localAddr.Output(aContext->iLocalHost);          
     
     aContext->iLocalPathMSRPDataPckg().iLocalHost.Copy( aContext->iLocalHost );
-    aContext->iLocalPathMSRPDataPckg().iSessionID = *(aContext->iLocalSessionID);
     
     TInt reason = aContext->Write(0, aContext->iLocalPathMSRPDataPckg);     
     aContext->CompleteClient(KErrNone);
@@ -535,13 +675,21 @@
 TStateBase* TStateConnecting::EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext)
     {
     MSRPLOG2("Entered TStateConnecting Event %d",aEvent);
-    TStateBase *state;
+    TStateBase *state = this;
 
     switch(aEvent)
         {
+        case EMSRPProcessQueuedRequestsEvent:
+        aContext->CompleteClient(KErrNone);              
+        break;
+        
         case EConnectionStateChangedEvent:
         state = handleConnectionStateChangedL(aContext);
         break;
+        
+        case EMSRPDataSendMessageEvent:
+        aContext->QueueClientSendRequestsL();                         
+        break;
                  
         default:                      
         MSRPLOG2("TStateConnecting::EventL :: Err!! Invalid state to have received %d",
@@ -553,80 +701,11 @@
     return state;    
     }
 
-TStateBase* TStateWaitForClient::fileSendCompleteL(CMSRPServerSubSession *aContext)
-    {
-    CMSRPMessageHandler *outgoingMessageHandler = aContext->iOutMsgQ.getHead();
-    
-    if( outgoingMessageHandler  && outgoingMessageHandler->IsMessageComplete() )
-        {
-            aContext->iOutMsgQ.explicitRemove(outgoingMessageHandler);    
-             delete outgoingMessageHandler;
-             aContext->iSendCompleteNotify = TRUE;
-         }
-    return aContext->StateFactory().getStateL( EWaitForClient );   
-    }   
-
-TStateBase * TStateWaitForClient::handleResponseSentL( CMSRPServerSubSession *aContext)
-    {
-    CMSRPMessageHandler *oriMessageHandler = aContext->iReceiveFileMsgHdler;
-    oriMessageHandler->UpdateResponseStateL(aContext->iReceivedResp);
-    if(oriMessageHandler->FileTransferComplete() )
-        {
-        aContext->iReceiveCompleteNotify = TRUE;              
-        }
-    
-    return aContext->StateFactory().getStateL(EWaitForClient);    
-    }
-
 TStates TStateWaitForClient::identity()
     {
     return EWaitForClient;
     }
  
-TStateBase* TStateBase::handleSendFileL(CMSRPServerSubSession *aContext)
-    {    
-    MSRPLOG("TStateBase::handleSendFileL() enter");
-    aContext->ReadSendDataPckgL(); 
-    CMSRPMessageHandler *aMessageHandler = CMSRPMessageHandler::NewL(aContext,
-            aContext->iSendMSRPdataPckg().iExtMessageBuffer); 
-    
-    aMessageHandler->SendFileL(*aContext->iConnection);                                        
-    
-    aContext->iOutMsgQ.Queue(*aMessageHandler);    
-    aContext->CompleteClient( KErrNone );
-    
-    aContext->iFileShare = TRUE;
-    MSRPLOG("TStateBase::handleSendFileL() exit"); 
-    if(!aContext->listnerSetupComplete())
-        {
-        return aContext->StateFactory().getStateL(EWaitForClient);
-        }
-    
-    return aContext->StateFactory().getStateL(EFileShare);
-    }
- 
-TStateBase* TStateBase::handleReceiveFileL(CMSRPServerSubSession *aContext)
-     {     
-     MSRPLOG("TStateBase::handleReceiveFileL() enter");
-    
-     aContext->ReadSendDataPckgL(); 
-     
-     aContext->iReceiveFileMsgHdler = CMSRPMessageHandler::NewL(aContext,
-                             aContext->iSendMSRPdataPckg().iExtMessageBuffer); 
-      
-     
-     aContext->iReceiveFileMsgHdler->ReceiveFileL();
-     aContext->CompleteClient( KErrNone );
-     aContext->iFileShare = TRUE;
-     MSRPLOG("TStateBase::handleReceiveFileL() exit");
-     if(!aContext->listnerSetupComplete())
-         {
-         return aContext->StateFactory().getStateL(EWaitForClient);
-         }
-     
-     return aContext->StateFactory().getStateL(EFileShare);     
-     }
-   
 TStateBase* TStateWaitForClient::EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext)
     {
       // In the TStateWaitForClient stat the server subsession waits for the client to setup 
@@ -638,6 +717,10 @@
       TStateBase *state = NULL;
       switch(aEvent)
           {
+          case EMSRPProcessQueuedRequestsEvent:
+              aContext->CompleteClient(KErrNone);              
+              break;
+          
           case EMSRPListenMessagesEvent:
               if(!aContext->iIncommingMessageListner.set(*(aContext->iClientMessage)))
                   {
@@ -662,26 +745,40 @@
               break;  
               
           case EMSRPDataSendCompleteEvent:
-              // Data Send Complete received in the TWaitForClient state is 
-              // not handeled. At Data Send Complete messae with Failure Report 
-              // header set to "no" need to inform the client about completion.
-              // Currently Queuing of completion events is not supported.
-              if(aContext->iFileShare)
+          case EMSRPDataCancelledEvent:
+              {
+              MSRPLOG("TStateWaitForClient::EventL EMSRPDataCancelledEvent");
+
+              if( aContext->iCurrentMsgHandler->IsMessageComplete() )
                   {
-                  state = fileSendCompleteL(aContext);
-                  break;
+                  MSRPLOG("TStateWaitForClient::EventL moving to pending data");
+                  aContext->iOutMsgQ.explicitRemove( aContext->iCurrentMsgHandler );    
+                  aContext->iPendingDataSendCompleteQ.Queue( *aContext->iCurrentMsgHandler );
                   }
-              MSRPLOG2("TStateWaitForClient::Not supported, Please check %d",aEvent);                     
+              aContext->iCurrentMsgHandler = NULL;
               break;
+              }
               
           case EMSRPResponseSendCompleteEvent:
-              if(aContext->iFileShare)
+              {
+              if( aContext->iReceivedResp->IsMessageComplete() )
                   {
-                  state = handleResponseSentL(aContext);  
-                  break;
+                  aContext->iPendingDataIncCompleteQ.Queue( *aContext->iReceivedResp );
                   }
+              aContext->iReceivedResp = NULL;
               break;
-  
+              }
+
+          case EMSRPReportSendCompleteEvent:
+              {
+              if( aContext->iReceivedReport->IsMessageComplete() )
+                  {
+                  aContext->iPendingDataIncCompleteQ.Queue( *aContext->iReceivedReport );
+                  }
+              aContext->iReceivedReport = NULL;
+              break;
+              }
+
           case EMSRPDataSendMessageEvent:
               aContext->QueueClientSendRequestsL();                         
               break;
@@ -690,31 +787,43 @@
           case EMSRPCancelSendRespListeningEvent:
                handleClientListnerCancelL(aContext, aEvent);
                break;
+               
+          case EMSRPDataSendMessageCancelEvent:
+              {
+              HandleClientCancelSendingL( aContext );
+              break;
+              }
 
           case EConnectionStateChangedEvent:
               state = handleConnectionStateChangedL(aContext);
               break;
               
           case EMSRPSendProgressEvent:
-          case EMSRPReceiveProgressEvent:
-              //ignore event if no listener
-              MSRPLOG("TStateWaitForClient::EventL Ignoring Progress Event")
-              state = aContext->StateFactory().getStateL(EWaitForClient);
+              {
+              state = aContext->StateFactory().getStateL( EWaitForClient );
+              // queue only if this msghandler is not already in the queue
+              if ( aContext->iPendingSendProgressQ.FindElement( aContext->iSendProgressMsg ) == NULL )
+                  {
+                  aContext->iPendingSendProgressQ.Queue( *aContext->iSendProgressMsg );                  
+                  }
               break;
-
-          case EMSRPSendFileEvent:
-               state =  handleSendFileL(aContext);
-               break;
-               
-          case EMSRPReceiveFileEvent :
-               state =  handleReceiveFileL(aContext);
-               break;    
+              }
+          case EMSRPReceiveProgressEvent:
+              {
+              // Queue any thing that comes.
+              state = aContext->StateFactory().getStateL( EWaitForClient );
+              // queue only if this msghandler is not already in the queue
+              if ( aContext->iPendingReceiveProgressQ.FindElement( aContext->iReceiveProgressMsg ) == NULL )
+                  {
+                  aContext->iPendingReceiveProgressQ.Queue( *aContext->iReceiveProgressMsg );                  
+                  }
+              break;
+              }
                   
           default:          
               // Any such error usually a client/server protocol voilation or connection/subsession 
               // protocol voilation. A bug to fix!!
-              
-              MSRPLOG2("TStateWaitForClient::EventL :: Err!! Invalid state to have received %d",aEvent);                     
+              MSRPLOG2("TStateWaitForClient::EventL :: Err!! Invalid state was received %d",aEvent);                     
               state = HandleStateErrorL(aContext);
               break;              
           };
@@ -722,33 +831,18 @@
       if(NULL == state)
         {
           // State not set.
-          if(!aContext->listnerSetupComplete())
+          if( !aContext->listnerSetupComplete() )
               {
               state = this;
               }
-          else if (aContext->iFileShare)
+          else
               {
-                  state = aContext->StateFactory().getStateL(EFileShare);
-                  
-                  if(aContext->iReceiveCompleteNotify)
-                      {
-                      aContext->NotifyFileReceiveResultToClientL(NULL);
-                      state = aContext->StateFactory().getStateL(EWaitForClient);
-                      }
-                  else if (aContext->iSendCompleteNotify)
-                      {
-                      aContext->NotifyFileSendResultToClientL(NULL);
-                      state = aContext->StateFactory().getStateL(EWaitForClient);
-                      }
-                  else if(!aContext->QueuesEmpty())
-                      state = state->handleQueuesL(aContext);                   
+              state = handleQueuesL(aContext);
               }
-          else
-            state = handleQueuesL(aContext);                  
         }
         return state;    
     }
-
+    
 TStates TStateActive::identity()
     {
     return EActive;
@@ -772,14 +866,6 @@
               state =  handleInCommingMessagesL(aContext);
               break; 
  
-         case EMSRPSendFileEvent:
-              state =  handleSendFileL(aContext);
-              break;
-              
-         case EMSRPReceiveFileEvent :
-              state =  handleReceiveFileL(aContext);
-              break;
-             
          case EConnectionStateChangedEvent:
               state = handleConnectionStateChangedL(aContext);
               break;
@@ -787,8 +873,45 @@
          case EMSRPCancelReceivingEvent:          
          case EMSRPCancelSendRespListeningEvent:
               state =  handleClientListnerCancelL(aContext, aEvent);
-              break;             
- 
+              break;   
+         
+         case EMSRPDataSendMessageCancelEvent:
+             {
+             state = HandleClientCancelSendingL( aContext );
+             break;
+             }
+              
+         case EMSRPDataCancelledEvent:
+         case EMSRPDataSendCompleteEvent:
+             state = MessageSendCompleteL(aContext);
+             break;
+             
+         case EMSRPResponseSendCompleteEvent:
+             {
+             state = handleResponseSentL(aContext);  
+             break;
+             }
+
+         case EMSRPReportSendCompleteEvent:
+             {
+             state = handleReportSentL( aContext );  
+             break;
+             }
+
+         case EMSRPReceiveProgressEvent:
+             {
+             aContext->ReceiveProgressToClientL( aContext->iReceiveProgressMsg );
+             state = aContext->StateFactory().getStateL( EWaitForClient );
+             break;
+             }
+
+         case EMSRPSendProgressEvent:
+             {
+             aContext->SendProgressToClientL( aContext->iSendProgressMsg );
+             state = aContext->StateFactory().getStateL( EWaitForClient );
+             break;
+             }
+
          default: 
              // Any such error usually a client/server protocol voilation or connection/subsession 
              // protocol voilation. A bug to fix!!
@@ -811,287 +934,55 @@
      = CMSRPMessageHandler::NewL(aContext,
          aContext->iSendMSRPdataPckg().iExtMessageBuffer); 
     
-    msgHandler->SendMessageL( *aContext->iConnection );                    
-    aContext->iCurrentMsgHandler = msgHandler;
-    
+    msgHandler->SendMessageL( *aContext->iConnection );   
+    aContext->iOutMsgQ.Queue( *msgHandler );
     aContext->CompleteClient( KErrNone );
     
-    return aContext->StateFactory().getStateL(EActiveSend);
+    return aContext->StateFactory().getStateL( EActive );
     }
    
-TStateBase* TStateBase::handleInCommingMessagesL(CMSRPServerSubSession *aContext)
-     {
-     CMSRPMessageHandler* incommingMsg = aContext->iReceivedMsg;
-     aContext->iReceivedMsg = NULL;
-     
-     return processIncommingMessageL(aContext, incommingMsg);             
-     }
- 
-TStates TStateFileShare::identity()
-     {
-     return EFileShare;
-     } 
- 
-TStateBase* TStateFileShare::EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext)
-     {
-     TStateBase *state = NULL;
-     MSRPLOG2("Entered TStateFileShare Event %d",aEvent);
-     switch(aEvent)
-         {
-         case EMSRPDataSendCompleteEvent: // maps to file send complete
-              state = fileSendCompleteL(aContext);
-              break;
-             
-         case EMSRPIncomingMessageReceivedEvent:  // incoming responses to file chunks
-             state =  handleInCommingMessagesL(aContext);
-              break;
-              
-         case EMSRPResponseSendCompleteEvent:
-             state = handleResponseSentL(aContext);  
-              break;
-         
-         case EMSRPSendProgressEvent:
-             state = handleSendProgressL(aContext);
-             break;
-             
-         case EMSRPReceiveProgressEvent:
-             state = handleReceiveProgressL(aContext);             
-             break;
-                  
-         case EConnectionStateChangedEvent :
-             state = handleConnectionStateChangedL(aContext); 
-             break;
-
-              
-         case EMSRPCancelReceivingEvent:
-         case EMSRPCancelSendRespListeningEvent:
-              state =  handleClientListnerCancelL(aContext, aEvent);
-              break;  
-         default:
-               MSRPLOG2("TStateFileShare::EventL :: Err!! Invalid state to have received %d",aEvent);                     
-              // state =  HandleStateErrorL(aContext);      //handle error state       
-               break;
-         
-         }
-         return state;
-     }
- 
-TStateBase * TStateFileShare::handleSendProgressL( CMSRPServerSubSession *aContext)
-     {
-     CMSRPMessageHandler *outgoingMessageHandler = aContext->iOutMsgQ.getHead();
-     aContext->SendProgressToClientL(outgoingMessageHandler);
-     return aContext->StateFactory().getStateL( EWaitForClient ); 
-     }
- 
-TStateBase * TStateFileShare::handleReceiveProgressL( CMSRPServerSubSession *aContext)
-     {
-     CMSRPMessageHandler *oriMessageHandler = aContext->iReceiveFileMsgHdler;     
-     aContext->ReceiveProgressToClientL(oriMessageHandler);
-     return aContext->StateFactory().getStateL( EWaitForClient );
-     }
- 
-TStateBase * TStateFileShare::handleResponseSentL( CMSRPServerSubSession *aContext)
-     {
-     CMSRPMessageHandler *oriMessageHandler = aContext->iReceiveFileMsgHdler;
-     oriMessageHandler->UpdateResponseStateL(aContext->iReceivedResp);
-     
-
-      if(oriMessageHandler->FileTransferComplete() )
-         {
-         //Notify client
-         aContext->NotifyFileReceiveResultToClientL(oriMessageHandler);
-         delete oriMessageHandler;
-         aContext->iReceiveFileMsgHdler = NULL;
-         return aContext->StateFactory().getStateL(EWaitForClient);
-         }
-     
-     if(!aContext->listnerSetupComplete())
-         {
-         return aContext->StateFactory().getStateL(EWaitForClient);
-         }
-     
-     return aContext->StateFactory().getStateL(EFileShare);
-     
-     }
-  
-TStateBase * TStateFileShare::handlesResponseL(CMSRPServerSubSession *aContext,
-                  CMSRPMessageHandler *incommingMsgHandler)
-      {
-      TStateBase *nextState; 
-      MSRPLOG("TStateFileShare::handlesFileResponseL Entered!");
-      
-      // Search the outgoing Queue to find the owner of  this response.
-      CMSRPMessageHandler *outgoingMsgHandler = 
-                         aContext->iOutMsgQ.getMatch(incommingMsgHandler);
-
-      nextState = this;
-      if(NULL != outgoingMsgHandler)
-         {
-         CleanupStack::PushL(incommingMsgHandler);
-         outgoingMsgHandler->ConsumeFileResponseL(*incommingMsgHandler);
-        
-         if(outgoingMsgHandler->FileTransferComplete())    
+TStateBase* TStateActive::handleResponseSentL( CMSRPServerSubSession* aContext )
+    {
+    MSRPLOG("-> TStateActive::handleResponseSentL");
+    if( aContext->iReceivedResp->IsMessageComplete() )
+        {
+        if ( !aContext->iReceivedResp->SendReportL(aContext, *aContext->iConnection, EAllOk ) )
             {
-             //notify client
-            aContext->NotifyFileSendResultToClientL(outgoingMsgHandler);
-            aContext->iOutMsgQ.explicitRemove(outgoingMsgHandler);    
-            delete outgoingMsgHandler;        
-            nextState = aContext->StateFactory().getStateL(EWaitForClient);
-            }    
-        
-         CleanupStack::Pop(incommingMsgHandler);
-         }
-      delete incommingMsgHandler;
-      MSRPLOG("TStateFileShare::handlesResponseL Exit!");
-      if(!aContext->listnerSetupComplete())
-          {
-          return aContext->StateFactory().getStateL(EWaitForClient);
-          }
-      return nextState; 
-      }
-  
-TStateBase * TStateFileShare::handleRequestsL(CMSRPServerSubSession *aContext,
-                 CMSRPMessageHandler *incommingMsgHandler)
-     {     
-     if(MMSRPIncomingMessage::EMSRPMessage == incommingMsgHandler->MessageType())
-         {
-         CMSRPMessageHandler *oriMessageHandler = aContext->iReceiveFileMsgHdler;
-         
-         if(oriMessageHandler->IsInFile())
-             {   
-             oriMessageHandler->WritetoFileL(incommingMsgHandler);
-             incommingMsgHandler->SendResponseL(aContext, *aContext->iConnection,CMSRPResponse::EAllOk);
-             if(!incommingMsgHandler->IfResponseReqL())
-                 {
-                 delete incommingMsgHandler;
-                 if(oriMessageHandler->FileTransferComplete())
-                     {
-                     aContext->NotifyFileReceiveResultToClientL(oriMessageHandler);
-                     delete oriMessageHandler;
-         	         aContext->iReceiveFileMsgHdler = NULL;
-                     return aContext->StateFactory().getStateL(EWaitForClient);   
-                     }
-                 }
-           
-             else
-                 {
-                 aContext->iPendingForDeletionQ.Queue(*incommingMsgHandler);
-                 }              
-              }
-          }
-     else
-         {
-         MSRPLOG("Reports not supported.!!");
-         delete incommingMsgHandler;         
-         }
-     if(!aContext->listnerSetupComplete())
-         {
-         return aContext->StateFactory().getStateL(EWaitForClient);
-         }
-     return this; 
-     }
- 
-TStateBase* TStateFileShare::fileSendCompleteL(CMSRPServerSubSession *aContext)
-     {
-     CMSRPMessageHandler *outgoingMessageHandler = aContext->iOutMsgQ.getHead();
-     
-     if( outgoingMessageHandler  && outgoingMessageHandler->IsMessageComplete() )
-         {
-             //notify client
-              aContext->NotifyFileSendResultToClientL( outgoingMessageHandler );
-              aContext->iOutMsgQ.explicitRemove(outgoingMessageHandler);    
-              delete outgoingMessageHandler;
-              return aContext->StateFactory().getStateL( EWaitForClient ); 
-          }
-         // response needed keep it on the outmsg queue itself
-     return aContext->StateFactory().getStateL( EFileShare );   
-     }   
- 
-TStates TStateActiveSend::identity()
-    {
-    return EActiveSend;
-    }
- 
-TStateBase* TStateActiveSend::EventL(TMSRPFSMEvent aEvent, CMSRPServerSubSession *aContext)
-    {
-     // ActiveSend state. The subsession is busy sending earlier data. Any further requests to 
-     // send data from the client will be queued. Any Message received will be queued till 
-     // EMSRPDataSendCompleteEvent is received. 
-     // After this Message Received Queue will be processed to check for any 
-     // incoming messages/responses.
-     // After that Message send queue will be processed to see if there any pending messages to 
-     // trasmitt.
-     // If both the queues are empty move back to Active State.
-
-     TStateBase *state;
-     MSRPLOG2("Entered TStateActiveSend Event %d",aEvent); 
- 
-     switch(aEvent)
-         {
-         case EMSRPDataSendMessageEvent:
-             aContext->QueueClientSendRequestsL();
-             state = this;          
-             break;
-     
-         case EMSRPDataSendCompleteEvent:
-             state = MessageSendCompleteL(aContext);
-             break;
- 
-         case EMSRPIncomingMessageReceivedEvent:
-             // Queue any thing that comes.
-             aContext->iInCommingMsgQ.Queue(*aContext->iReceivedMsg);
-             state = this;           
-             break;
-
-         case EConnectionStateChangedEvent:
-              state = handleConnectionStateChangedL(aContext);
-              break;
-              
-         case EMSRPCancelReceivingEvent:          
-         case EMSRPCancelSendRespListeningEvent:
-             state =  handleClientListnerCancelL(aContext, aEvent);
-             break;              
- 
-         default: 
-             // Any such error usually a client/server protocol voilation or connection/subsession 
-             // protocol voilation. A bug to fix!!
-             
-             MSRPLOG2("TStateActiveSend::EventL :: Err!! Invalid state to have received %d",aEvent);                     
-             state =  HandleStateErrorL(aContext);            
-             break; 
-         } 
-     return state;
-    }
- 
-TStateBase * TStateActiveSend::MessageSendCompleteL(CMSRPServerSubSession *aContext)
-    {
-    // Handle send message complete event.
-    if( NULL == aContext->iCurrentMsgHandler)
-        {
-        MSRPLOG( "TStateActiveSend::MessageSendCompleteL :: iCurrentMsgHandler is NULL \n" );                                     
-        return this;
-        }
-        
-    if( aContext->iCurrentMsgHandler->IsMessageComplete() )
-        {
-        // Messages with Failure Report set to "No" will never get a response.        
-        TBool error = aContext->sendResultToClientL( aContext->iCurrentMsgHandler );        
-        delete aContext->iCurrentMsgHandler;
-        aContext->iCurrentMsgHandler = NULL;
-        
-        return aContext->StateFactory().getStateL( EWaitForClient );
+            if ( aContext->iReceivedResp->IsTransmissionTerminated() )
+                {
+                if( aContext->iIncommingMessageListner.Check() )
+                    {
+                    aContext->iIncommingMessageListner.Complete( KErrCancel );
+                    }
+                }
+            else
+                {
+                aContext->sendMsgToClientL( aContext->iReceivedResp );
+                }
+            return aContext->StateFactory().getStateL(EWaitForClient);
+            }
+        else
+            {
+            aContext->iReceivedResp = NULL;
+            }
         }
     else
         {
-        // Message expects a response to come. Put this out the OutGoing Queue.
-        aContext->iOutMsgQ.Queue( *(aContext->iCurrentMsgHandler) );
-        aContext->iCurrentMsgHandler = NULL;
-        
-        // Handle any pending events in Queue.
-        return handleQueuesL(aContext);     
+        aContext->iReceivedResp->ResponseHandled();   
+        aContext->iReceivedResp = NULL;
         }
-    } 
+    MSRPLOG("<- TStateBase::handleRequestsL");
+    return aContext->StateFactory().getStateL( EActive );
+    }
 
+TStateBase* TStateActive::handleReportSentL( CMSRPServerSubSession* aContext)
+    {
+    MSRPLOG("-> TStateActive::handleReportSentL");
+    aContext->sendReportToClientL( aContext->iReceivedReport );
+    aContext->iPendingDataIncCompleteQ.Queue( *aContext->iReceivedReport );
+    aContext->iReceivedReport = NULL;
+    return aContext->StateFactory().getStateL( EWaitForClient );
+    }
 
 TStates TStateError::identity()
     {
@@ -1115,7 +1006,7 @@
             break;
             
         case EMSRPListenSendResultEvent:
-            aContext->CompleteClient(EInvalidAction); 
+            aContext->CompleteClient( KErrGeneral ); 
             state = this;
             break;
             
--- a/Msrp/inc/MsrpCommon.h	Sat Jun 12 14:30:11 2010 +0530
+++ b/Msrp/inc/MsrpCommon.h	Thu Nov 25 13:59:42 2010 +0200
@@ -38,7 +38,7 @@
 const TInt KSecondinMicroseconds( 1000000 );
 
 const TInt KListenTimeoutInSeconds( 30 );
-const TInt KBufSize = 4096;
+const TInt KBufSize = 16384;
 const TInt KThreshold = 1024;
 
 #endif
@@ -97,6 +97,7 @@
 const TInt KMaxLengthOfHost = 255;
 const TInt KMaxLengthOfSessionId = 255;
 const TInt KSizeOfProgramPath = 50;
+const TInt KBufExpandSize = 256;
 
 // maximum length of incoming message buffer (for externalizing CMSRPMessage
 // class
@@ -167,8 +168,24 @@
 #endif // END MACROS
 
 // ENUMS
+
+/** Error codes returned to the client */
+enum TMSRPErrorCodes
+    {
+    EUnknownCode = 1,
+    EAllOk = 200,
+    EUnintelligibleRequest = 400,
+    EActionNotAllowed = 403,
+    ETimeout = 408,
+    EStopSending = 413,
+    EMimeNotUnderstood = 415,
+    EParameterOutOfBounds = 423,
+    ESessionDoesNotExist = 481,
+    EUnknownRequestMethod = 501,
+    ESessionAlreadyBound = 506
+    };
+
 // MSRP API IPC request definitions
-
 enum TMSRPRequests
 	{
     EMSRPCreateSubSession,
@@ -179,11 +196,11 @@
     EMSRPListenMessages,
     EMSRPListenSendResult,
     EMSRPSendMessage,    
-    EMSRPSendFile,
-    EMSRPReceiveFile,
 	EMSRPCancelSending,
 	EMSRPCancelReceiving,
 	EMSRPCancelSendRespListening,
+	EMSRPProcessQueuedRequests,
+	EMSRPProgressReports,
 	EMSRPReserved
 	};
 
@@ -215,22 +232,10 @@
     EPartial
     };
 
-enum TErrorCode
-    {
-    EUndefined = -1,
-    ENoError = 0,
-    ENetworkTimeout = 1,
-    EUnrecoverableError = 2,    
-    ELocalTimeout = 3,
-    EInvalidAction = 4
-    };
-
-
 // Local host name and session id
 typedef struct TLocalPathMSRPData
     {
     TBuf8< KMaxLengthOfHost> iLocalHost;
-    TBuf8< KMaxLengthOfSessionId > iSessionID;
     } TLocalPathMSRPData;
     
 
@@ -250,6 +255,7 @@
 	TUint iRemotePort;
 	TBuf8< KMaxLengthOfSessionId > iRemoteSessionID;
 	TBuf8< KMaxLengthOfIncomingMessageExt > iExtMessageBuffer;
+    TBuf8< KMaxLengthOfSessionId > iMessageId;
 	TBool iIsMessage;
 	TBool iIsProgress;
     TInt iBytesRecvd;