Msrp/MsrpHeader/inc/CMsrpMessage.h
author shivsood
Sat, 12 Jun 2010 14:30:11 +0530
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
permissions -rw-r--r--
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia. MSRP Implementation as per RFC 4975 and RCS specifications that supports 1. Multiple one to one chat data sessions as per RCS/RFC 4975 specifications. 2. Multiple file Sharing sessions as per RCS. 3. Data Chunking requirements as per 4975. 3. MSRP Connection sharing requirements as per RFC 4975

/*
* 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 CMSRPMESSAGE_H
#define CMSRPMESSAGE_H

//  INCLUDES
#include <e32base.h>
#include <s32strm.h>
#include <f32file.h>

#include "CMSRPMessageBase.h"

/**
*  @publishedAll
*
*  Class provides functions for creation and manipulation of MSRP headers
*/
class CMSRPMessage : public CMSRPMessageBase
    {
    public:  // Constructors and destructor

        /**
        * Constructor.
        */
	    IMPORT_C CMSRPMessage();

        /**
        * Destructor.
        */
		IMPORT_C ~CMSRPMessage();

    public: // New functions

		/**
		* Sets the content of the message to be sent
		* Message maximum length is 2048 bytes, longer message will
		* have to be sent in chunks by the client
		* @param aContent message to be sent
		*/
		IMPORT_C void SetContent( HBufC8* aContent );
		
		/**
		* Gets the content buffer, if set
		* @return pointer to content buffer, ownership is not transferred
		*/
		IMPORT_C const TDesC8& Content( );
		
		/**
		* Check if the contents of the message have been set
		* @return true if set
		*/
		IMPORT_C TBool IsContent( ) const;

		/**
		* Check if the given externalised buffer contains MSRP Message
 		* @param aBuffer a Buffer containing the value of the
		*        externalized object
		* @return true if Buffer contains MSRP message
		*/
		IMPORT_C static TBool IsMessage( const TDesC8& aBuffer );
        
		  /**
		  * Checks if File
		  */
		        
		IMPORT_C TBool IsFile( );
		        
		 /**
		  * Sets the FileName for a FileSession
		  */
		IMPORT_C void SetFileName( const TFileName& aFileName );
		        
		 /**
		 * Gets the FileName for a FileSession
		 */
		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
		*        externalized object
		* @return Internalized CMSRPMessage object, ownership is transferred
		*/
		IMPORT_C static CMSRPMessage* 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  );
        
    private: // Data

		// content buffer
		HBufC8* iContentBuffer;

	   // filename
	   TFileName iFileName;
	   
	   //filesize
	   TInt iFileSize;
	   
	   //Granularity of the file
	   TBool iNotifyProgress;
	};

#endif // CMSRPMESSAGE_H

// End of File