2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipretryafterheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPRETRYAFTERHEADER_H
26 #define CSIPRETRYAFTERHEADER_H
29 #include "sipparameterheaderbase.h"
31 // FORWARD DECLARATIONS
32 class CSIPRetryAfterHeaderParams;
39 * Class provides functions for setting and getting parameters in SIP
40 * "Retry-After" header.
44 class CSIPRetryAfterHeader : public CSIPParameterHeaderBase
46 public: // Constructors and destructor
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
55 IMPORT_C static CSIPRetryAfterHeader* DecodeL(const TDesC8& aValue);
58 * Creates a new instance of CSIPRetryAfterHeader
59 * @param aRetryAfter a retry after value.
60 * @return a new instance of CSIPRetryAfterHeader
62 IMPORT_C static CSIPRetryAfterHeader* NewL(TUint aRetryAfter);
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
70 IMPORT_C static CSIPRetryAfterHeader* NewLC(TUint aRetryAfter);
73 * Destructor, deletes the resources of CSIPRetryAfterHeader.
75 IMPORT_C virtual ~CSIPRetryAfterHeader();
78 public: // New functions
81 * Sets the retry after value
82 * @param aValue a new retry after value to set.
84 IMPORT_C void SetRetryAfter(TUint aValue);
87 * Gets the retry after value
88 * @return a retry after value
90 IMPORT_C TUint RetryAfter() const;
93 * Gets the comment value
94 * @return a comment value or KNullDesC8
96 IMPORT_C const TDesC8& Comment() const;
99 * Gets the value of the "duration"-parameter
100 * @return the "duration"-parameter, or
101 * KErrNotFound if the parameter is not present.
103 IMPORT_C TInt DurationParam() const;
106 * Sets the "duration"-parameter
107 * @pre aDurationParam >= 0
108 * @param aDurationParam a "duration"-parameter value to set
110 IMPORT_C void SetDurationParamL(TInt aDurationParam);
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
118 IMPORT_C static CSIPHeaderBase*
119 InternalizeValueL(RReadStream& aReadStream);
122 public: // From CSIPHeaderBase
125 * From CSIPHeaderBase CloneL
127 IMPORT_C CSIPHeaderBase* CloneL() const;
130 * From CSIPHeaderBase Name
132 IMPORT_C RStringF Name() const;
135 public: // From CSIPHeaderBase, for internal use
137 TPreferredPlace PreferredPlaceInMessage() const;
139 public: // New functions, for internal use
141 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
143 private: // From CSIPHeaderBase
145 void ExternalizeValueL(RWriteStream& aWriteStream) const;
147 private: // From CSIPParameterHeaderBase
149 HBufC8* ToTextMandatoryPartLC() const;
150 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
151 const CSIPParamContainerBase& Params() const;
152 CSIPParamContainerBase& Params();
154 private: // Constructors
156 CSIPRetryAfterHeader();
157 CSIPRetryAfterHeader(TUint aRetryAfter);
159 void ConstructL(const CSIPRetryAfterHeader& aRetryAfterHeader);
161 private: // New functions
163 void DoInternalizeValueL(RReadStream& aReadStream);
169 CSIPRetryAfterHeaderParams* iParams;
171 private: // For testing purposes
173 friend class CSIPRetryAfterHeaderTest;
177 #endif // end of CSIPRETRYAFTERHEADER_H