epoc32/include/sipretryafterheader.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 sipretryafterheader.h
     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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 #include "_sipcodecdefs.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CSIPRetryAfterHeaderParams;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37 * @publishedAll
       
    38 * @released
       
    39 *
       
    40 * Class provides functions for setting and getting parameters in SIP 
       
    41 * "Retry-After" header.
       
    42 *
       
    43 *  @lib sipcodec.lib
       
    44 */
       
    45 class CSIPRetryAfterHeader : public CSIPParameterHeaderBase
       
    46 	{
       
    47 	public:	// Constructors and destructor
       
    48 
       
    49 		/**
       
    50 		* Constructs a CSIPRetryAfterHeader from textual representation 
       
    51 		* of the header's value part.
       
    52 		* @param aValue a value part of a "Retry-After"-header 
       
    53 		*        (e.g. "18000;duration=3600")
       
    54 		* @return a new instance of CSIPRetryAfterHeader   
       
    55 		*/
       
    56 		IMPORT_C static CSIPRetryAfterHeader* DecodeL(const TDesC8& aValue);
       
    57 
       
    58 		/**
       
    59 		* Creates a new instance of CSIPRetryAfterHeader
       
    60 		* @param aRetryAfter a retry after value.
       
    61 		* @return a new instance of CSIPRetryAfterHeader
       
    62 		*/
       
    63         IMPORT_C static CSIPRetryAfterHeader* NewL(TUint aRetryAfter);
       
    64 
       
    65 		/**
       
    66 		* Creates a new instance of CSIPRetryAfterHeader
       
    67         * On return the new instance has left to the CleanupStack.
       
    68 		* @param aRetryAfter a retry after value.
       
    69 		* @return a new instance of CSIPRetryAfterHeader
       
    70 		*/
       
    71         IMPORT_C static CSIPRetryAfterHeader* NewLC(TUint aRetryAfter);
       
    72 
       
    73         /**
       
    74 		* Destructor, deletes the resources of CSIPRetryAfterHeader.
       
    75 		*/
       
    76 		IMPORT_C virtual ~CSIPRetryAfterHeader();
       
    77 
       
    78 
       
    79 	public: // New functions
       
    80 
       
    81 		/**
       
    82 		* Sets the retry after value
       
    83 		* @param aValue a new retry after value to set.
       
    84 		*/
       
    85 		IMPORT_C void SetRetryAfter(TUint aValue);
       
    86 
       
    87 		/**
       
    88 		* Gets the retry after value
       
    89 		* @return a retry after value
       
    90 		*/
       
    91 		IMPORT_C TUint RetryAfter() const;
       
    92 
       
    93 		/**
       
    94 		* Gets the comment value
       
    95 		* @return a comment value or KNullDesC8
       
    96 		*/
       
    97 		IMPORT_C const TDesC8& Comment() const;
       
    98 
       
    99 		/**
       
   100 		* Gets the value of the "duration"-parameter
       
   101 		* @return the "duration"-parameter, or 
       
   102 		*         KErrNotFound if the parameter is not present.
       
   103 		*/
       
   104 		IMPORT_C TInt DurationParam() const;
       
   105 
       
   106 		/**
       
   107 		* Sets the "duration"-parameter
       
   108 		* @pre aDurationParam >= 0
       
   109 		* @param aDurationParam a "duration"-parameter value to set
       
   110 		*/
       
   111 		IMPORT_C void SetDurationParamL(TInt aDurationParam);
       
   112 
       
   113         /**
       
   114 		* Constructs an instance of a CSIPRetryAfterHeader from a RReadStream
       
   115 		* @param aReadStream a stream containing the value of the
       
   116 		*        externalized object (header name not included). 
       
   117 		* @return an instance of a CSIPRetryAfterHeader
       
   118 		*/
       
   119 		IMPORT_C static CSIPHeaderBase* 
       
   120             InternalizeValueL(RReadStream& aReadStream);
       
   121         
       
   122 
       
   123 	public: // From CSIPHeaderBase
       
   124 
       
   125 		/**
       
   126 		* From CSIPHeaderBase CloneL
       
   127 		*/
       
   128 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   129 
       
   130 		/**
       
   131 		* From CSIPHeaderBase Name
       
   132 		*/
       
   133 		IMPORT_C RStringF Name() const;
       
   134 
       
   135 
       
   136 	public: // From CSIPHeaderBase, for internal use
       
   137 
       
   138 		TPreferredPlace PreferredPlaceInMessage() const;
       
   139 
       
   140 	public: // New functions, for internal use
       
   141 
       
   142 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   143 
       
   144 	private: // From CSIPHeaderBase
       
   145 
       
   146 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   147 
       
   148 	private: // From CSIPParameterHeaderBase
       
   149 
       
   150 		HBufC8* ToTextMandatoryPartLC() const;
       
   151 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   152 		const CSIPParamContainerBase& Params() const;
       
   153 		CSIPParamContainerBase& Params();
       
   154 
       
   155 	private: // Constructors
       
   156 
       
   157         CSIPRetryAfterHeader();
       
   158 		CSIPRetryAfterHeader(TUint aRetryAfter);
       
   159         void ConstructL();
       
   160 		void ConstructL(const CSIPRetryAfterHeader& aRetryAfterHeader);
       
   161 
       
   162 	private: // New functions
       
   163 
       
   164 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   165 
       
   166 	private: // Data
       
   167 
       
   168 		TUint iRetryAfter;
       
   169         HBufC8* iComment;
       
   170 		CSIPRetryAfterHeaderParams* iParams;
       
   171 
       
   172 	private: // For testing purposes
       
   173 	
       
   174 		UNIT_TEST(CSIPRetryAfterHeaderTest)
       
   175 	};
       
   176 
       
   177 #endif // end of CSIPRETRYAFTERHEADER_H
       
   178 
       
   179 // End of File