realtimenetprots/sipfw/SIP/Codec/api/sipretryafterheader.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name        : sipretryafterheader.h
       
    16 * Part of     : SIP Codec
       
    17 * Interface   : SDK API, SIP Codec API
       
    18 * Version     : SIP/4.0 
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 #ifndef CSIPRETRYAFTERHEADER_H
       
    26 #define CSIPRETRYAFTERHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipparameterheaderbase.h"
       
    30 
       
    31 // FORWARD DECLARATIONS
       
    32 class CSIPRetryAfterHeaderParams;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 * @publishedAll
       
    37 * @released
       
    38 *
       
    39 * Class provides functions for setting and getting parameters in SIP 
       
    40 * "Retry-After" header.
       
    41 *
       
    42 *  @lib sipcodec.lib
       
    43 */
       
    44 class CSIPRetryAfterHeader : public CSIPParameterHeaderBase
       
    45 	{
       
    46 	public:	// Constructors and destructor
       
    47 
       
    48 		/**
       
    49 		* Constructs a CSIPRetryAfterHeader from textual representation 
       
    50 		* of the header's value part.
       
    51 		* @param aValue a value part of a "Retry-After"-header 
       
    52 		*        (e.g. "18000;duration=3600")
       
    53 		* @return a new instance of CSIPRetryAfterHeader   
       
    54 		*/
       
    55 		IMPORT_C static CSIPRetryAfterHeader* DecodeL(const TDesC8& aValue);
       
    56 
       
    57 		/**
       
    58 		* Creates a new instance of CSIPRetryAfterHeader
       
    59 		* @param aRetryAfter a retry after value.
       
    60 		* @return a new instance of CSIPRetryAfterHeader
       
    61 		*/
       
    62         IMPORT_C static CSIPRetryAfterHeader* NewL(TUint aRetryAfter);
       
    63 
       
    64 		/**
       
    65 		* Creates a new instance of CSIPRetryAfterHeader
       
    66         * On return the new instance has left to the CleanupStack.
       
    67 		* @param aRetryAfter a retry after value.
       
    68 		* @return a new instance of CSIPRetryAfterHeader
       
    69 		*/
       
    70         IMPORT_C static CSIPRetryAfterHeader* NewLC(TUint aRetryAfter);
       
    71 
       
    72         /**
       
    73 		* Destructor, deletes the resources of CSIPRetryAfterHeader.
       
    74 		*/
       
    75 		IMPORT_C virtual ~CSIPRetryAfterHeader();
       
    76 
       
    77 
       
    78 	public: // New functions
       
    79 
       
    80 		/**
       
    81 		* Sets the retry after value
       
    82 		* @param aValue a new retry after value to set.
       
    83 		*/
       
    84 		IMPORT_C void SetRetryAfter(TUint aValue);
       
    85 
       
    86 		/**
       
    87 		* Gets the retry after value
       
    88 		* @return a retry after value
       
    89 		*/
       
    90 		IMPORT_C TUint RetryAfter() const;
       
    91 
       
    92 		/**
       
    93 		* Gets the comment value
       
    94 		* @return a comment value or KNullDesC8
       
    95 		*/
       
    96 		IMPORT_C const TDesC8& Comment() const;
       
    97 
       
    98 		/**
       
    99 		* Gets the value of the "duration"-parameter
       
   100 		* @return the "duration"-parameter, or 
       
   101 		*         KErrNotFound if the parameter is not present.
       
   102 		*/
       
   103 		IMPORT_C TInt DurationParam() const;
       
   104 
       
   105 		/**
       
   106 		* Sets the "duration"-parameter
       
   107 		* @pre aDurationParam >= 0
       
   108 		* @param aDurationParam a "duration"-parameter value to set
       
   109 		*/
       
   110 		IMPORT_C void SetDurationParamL(TInt aDurationParam);
       
   111 
       
   112         /**
       
   113 		* Constructs an instance of a CSIPRetryAfterHeader from a RReadStream
       
   114 		* @param aReadStream a stream containing the value of the
       
   115 		*        externalized object (header name not included). 
       
   116 		* @return an instance of a CSIPRetryAfterHeader
       
   117 		*/
       
   118 		IMPORT_C static CSIPHeaderBase* 
       
   119             InternalizeValueL(RReadStream& aReadStream);
       
   120         
       
   121 
       
   122 	public: // From CSIPHeaderBase
       
   123 
       
   124 		/**
       
   125 		* From CSIPHeaderBase CloneL
       
   126 		*/
       
   127 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   128 
       
   129 		/**
       
   130 		* From CSIPHeaderBase Name
       
   131 		*/
       
   132 		IMPORT_C RStringF Name() const;
       
   133 
       
   134 
       
   135 	public: // From CSIPHeaderBase, for internal use
       
   136 
       
   137 		TPreferredPlace PreferredPlaceInMessage() const;
       
   138 
       
   139 	public: // New functions, for internal use
       
   140 
       
   141 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   142 
       
   143 	private: // From CSIPHeaderBase
       
   144 
       
   145 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   146 
       
   147 	private: // From CSIPParameterHeaderBase
       
   148 
       
   149 		HBufC8* ToTextMandatoryPartLC() const;
       
   150 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   151 		const CSIPParamContainerBase& Params() const;
       
   152 		CSIPParamContainerBase& Params();
       
   153 
       
   154 	private: // Constructors
       
   155 
       
   156         CSIPRetryAfterHeader();
       
   157 		CSIPRetryAfterHeader(TUint aRetryAfter);
       
   158         void ConstructL();
       
   159 		void ConstructL(const CSIPRetryAfterHeader& aRetryAfterHeader);
       
   160 
       
   161 	private: // New functions
       
   162 
       
   163 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   164 
       
   165 	private: // Data
       
   166 
       
   167 		TUint iRetryAfter;
       
   168         HBufC8* iComment;
       
   169 		CSIPRetryAfterHeaderParams* iParams;
       
   170 
       
   171 	private: // For testing purposes
       
   172 #ifdef CPPUNIT_TEST	
       
   173 		friend class CSIPRetryAfterHeaderTest;
       
   174 #endif
       
   175 	};
       
   176 
       
   177 #endif // end of CSIPRETRYAFTERHEADER_H
       
   178 
       
   179 // End of File