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 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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipsubscriptionstateheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPSUBSCRIPTIONSTATEHEADER_H
26 #define CSIPSUBSCRIPTIONSTATEHEADER_H
29 #include "sipparameterheaderbase.h"
30 #include "_sipcodecdefs.h"
32 // FORWARD DECLARATIONS
33 class CSIPSubscriptionStateHeaderParams;
40 * Class provides functions for setting and getting SIP "Subscription-State"
45 class CSIPSubscriptionStateHeader : public CSIPParameterHeaderBase
47 public: // Constructors and destructor
50 * Constructs a CSIPSubscriptionStateHeader from textual representation
51 * of the header's value part.
52 * @param aValue a value part of a "Subscription-State"-header
53 * @return a new instance of CSIPSubscriptionStateHeader
55 IMPORT_C static CSIPSubscriptionStateHeader* DecodeL(const TDesC8& aValue);
58 * Creates a new instance of CSIPSubscriptionStateHeader
59 * @param aSubStateValue a substate-value value
60 * @return a new instance of CSIPSubscriptionStateHeader
62 IMPORT_C static CSIPSubscriptionStateHeader*
63 NewL(const TDesC8& aSubStateValue);
66 * Creates a new instance of CSIPSubscriptionStateHeader
67 * and puts it to CleanupStack
68 * @param aSubStateValue a substate-value value
69 * @return a new instance of CSIPSubscriptionStateHeader
71 IMPORT_C static CSIPSubscriptionStateHeader*
72 NewLC(const TDesC8& aSubStateValue);
75 * Destructor, deletes the resources of CSIPSubscriptionStateHeader.
77 IMPORT_C ~CSIPSubscriptionStateHeader();
80 public: // New functions
83 * Gets the substate-value parameter from the "Subscription-State" header
84 * @return the substate-value parameter
86 IMPORT_C const TDesC8& SubStateValue() const;
89 * Sets the substate-value parameter in the "Subscription-State" header;
90 * @param aSubStateValue a substate-value parameter to set
92 IMPORT_C void SetSubStateValueL(const TDesC8& aSubStateValue);
95 * Gets the value of the "expires"-parameter
96 * @return "expires"-parameter or KErrNotFound if not present
98 IMPORT_C TInt ExpiresParameter() const;
101 * Sets the "expires"-parameter
102 * @pre aExpiresParam >= 0
103 * @param aExpiresParam a "expires"-parameter value to set
105 IMPORT_C void SetExpiresParameterL(TInt aExpiresParam);
108 * Gets the value of the "retry-after"-parameter
109 * @return "retry-after"-parameter or KErrNotFound if not present
111 IMPORT_C TInt RetryAfterParameter() const;
114 * Sets the "retry-after"-parameter
115 * @pre aRetryAfterParam >= 0
116 * @param aRetryAfterParam a "retry-after"-parameter value to set
118 IMPORT_C void SetRetryAfterParameterL(TInt aRetryAfterParam);
121 * Constructs an instance of a CSIPSubscriptionStateHeader
123 * @param aReadStream a stream containing the value of the
124 * externalized object (header name not included).
125 * @return an instance of a CSIPSubscriptionStateHeader
127 IMPORT_C static CSIPHeaderBase*
128 InternalizeValueL(RReadStream& aReadStream);
131 public: // From CSIPHeaderBase
134 * From CSIPHeaderBase CloneL
136 IMPORT_C CSIPHeaderBase* CloneL() const;
139 * From CSIPHeaderBase Name
141 IMPORT_C RStringF Name() const;
144 public: // From CSIPHeaderBase, for internal use
149 TPreferredPlace PreferredPlaceInMessage() const;
151 public: // New functions, for internal use
153 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
155 private: // From CSIPHeaderBase
157 void ExternalizeValueL(RWriteStream& aWriteStream) const;
159 private: // From CSIPParameterHeaderBase
161 HBufC8* ToTextMandatoryPartLC() const;
162 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
163 const CSIPParamContainerBase& Params() const;
164 CSIPParamContainerBase& Params();
166 private: // Constructors
168 CSIPSubscriptionStateHeader();
170 void ConstructL(const TDesC8& aSubStateValue);
171 void ConstructL (const CSIPSubscriptionStateHeader&
172 aSubscriptionStateHeader);
174 private: // New functions
176 void DoInternalizeValueL(RReadStream& aReadStream);
180 HBufC8* iSubStateValue;
181 CSIPSubscriptionStateHeaderParams* iParams;
183 private: // For testing purposes
185 UNIT_TEST(CSIPSubscriptionStateHeaderTest)
189 #endif // CSIPSUBSCRIPTIONSTATEHEADER_H