Msrp/MsrpHeader/inc/CMsrpResponse.h
branchMSRP_FrameWork
changeset 25 505ad3f0ce5c
child 58 cdb720e67852
equal deleted inserted replaced
22:f1578314b8da 25:505ad3f0ce5c
       
     1 /*
       
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html."
       
     8 * Initial Contributors:
       
     9 * Nokia Corporation - initial contribution.
       
    10 * Contributors:
       
    11 *
       
    12 * Description:
       
    13 * MSRP Implementation
       
    14 *
       
    15 */
       
    16 
       
    17 #ifndef CMSRPRESPONSE_H
       
    18 #define CMSRPRESPONSE_H
       
    19 
       
    20 //  INCLUDES
       
    21 #include <e32base.h>
       
    22 #include <s32strm.h>
       
    23 #include <stringpool.h>
       
    24 
       
    25 #include "CMSRPMessageBase.h"
       
    26 
       
    27 // CLASS DECLARATION
       
    28 
       
    29 
       
    30 /**
       
    31 *  @publishedAll
       
    32 *
       
    33 *  Class provides services for creating and manipulating MSRP response
       
    34 */
       
    35 class CMSRPResponse : public CMSRPMessageBase
       
    36 	{
       
    37     public:
       
    38 
       
    39 		/** Error codes */
       
    40 		enum TMSRPErrorCodes
       
    41 			{
       
    42 			EUnknownCode = 0,
       
    43 			EAllOk = 200,
       
    44 			EUnintelligibleRequest = 400,
       
    45 			EActionNotAllowed = 403,
       
    46 			ETimeout = 408,
       
    47 			EStopSending = 413,
       
    48 			EMimeNotUnderstood = 415,
       
    49 			EParameterOutOfBounds = 423,
       
    50 			ESessionDoesNotExist = 481,
       
    51 			EUnknownRequestMethod = 501,
       
    52 			ESessionAlreadyBound = 506
       
    53 			};
       
    54 
       
    55     public:  // Constructors and destructor
       
    56 
       
    57         /**
       
    58         * Constructor.
       
    59 	    * @param aStatusCode a known MSRP response status code.
       
    60 	    * Cannot be 100.
       
    61         */
       
    62 		IMPORT_C CMSRPResponse( TUint aStatusCode, RStringF aReasonPhrase );
       
    63 
       
    64         /**
       
    65         * Constructor
       
    66         */
       
    67 		IMPORT_C CMSRPResponse( );
       
    68 
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72 		IMPORT_C virtual ~CMSRPResponse();
       
    73 
       
    74     public: // New functions
       
    75 
       
    76 		/**
       
    77 		* Returns the MSRP Response status code
       
    78 		* @return MSRP Response status code
       
    79 		*/
       
    80     	IMPORT_C TUint StatusCode() const;
       
    81 
       
    82 		/**
       
    83 		* Gets a MSRP Response Reason Phrase
       
    84 		* @return a MSRP response reason phrase or an empty string if
       
    85         *   the reason phrase is not defined.
       
    86 		*/
       
    87     	IMPORT_C RStringF ReasonPhrase() const;
       
    88 
       
    89 		/**
       
    90 		* Sets a MSRP Response extension status code. It is not possible to set
       
    91         * value 100.
       
    92 		* @param aStatusCode extension status code
       
    93 		* @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700
       
    94 		*/
       
    95     	IMPORT_C void SetStatusCodeL( TUint aStatusCode );
       
    96 
       
    97 		/**
       
    98 		* Sets a MSRP Response Reason Phrase
       
    99 		* @param aReasonPhrase a MSRP response reason phrase.
       
   100 		*/
       
   101     	IMPORT_C void SetReasonPhrase( RStringF aReasonPhrase );
       
   102 
       
   103 		/**
       
   104 		* Internalizes object from a given stream
       
   105 		* @param aReadStream stream to read from
       
   106 		* @return CMSRPResponse if internalization successfull
       
   107 		*/
       
   108     	IMPORT_C static CMSRPResponse* InternalizeL( RReadStream& aReadStream );
       
   109 
       
   110 		/**
       
   111 		* Check if the given externalised buffer contains MSRP Response
       
   112  		* @param aBuffer a Buffer containing the value of the
       
   113 		*        externalized object
       
   114 		* @return true if Buffer contains MSRP response
       
   115 		*/
       
   116 		IMPORT_C static TBool IsResponse( const TDesC8& aBuffer );
       
   117 
       
   118 	public: // from base classes
       
   119 
       
   120 		// from CMSRPMessageBase
       
   121 		IMPORT_C void ExternalizeL( RWriteStream& aWriteStream );
       
   122 		
       
   123     private:
       
   124 
       
   125         /**
       
   126         * Internalizes the class from a given stream
       
   127 		* @param aReadStream stream to read from
       
   128         */
       
   129 	    void DoInternalizeL( RReadStream& aReadStream );
       
   130 
       
   131     private: // Data
       
   132 
       
   133 		// status code
       
   134 	    TUint iStatusCode;
       
   135 
       
   136 		// reason phrase text
       
   137 	    RStringF iReasonPhrase;
       
   138 	};
       
   139 
       
   140 #endif // CMSRPRESPONSE_H
       
   141 
       
   142 // End of File