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 : sipsubscriptionstateheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPSUBSCRIPTIONSTATEHEADER_H
26 #define CSIPSUBSCRIPTIONSTATEHEADER_H
29 #include "sipparameterheaderbase.h"
31 // FORWARD DECLARATIONS
32 class CSIPSubscriptionStateHeaderParams;
39 * Class provides functions for setting and getting SIP "Subscription-State"
44 class CSIPSubscriptionStateHeader : public CSIPParameterHeaderBase
46 public: // Constructors and destructor
49 * Constructs a CSIPSubscriptionStateHeader from textual representation
50 * of the header's value part.
51 * @param aValue a value part of a "Subscription-State"-header
52 * @return a new instance of CSIPSubscriptionStateHeader
54 IMPORT_C static CSIPSubscriptionStateHeader* DecodeL(const TDesC8& aValue);
57 * Creates a new instance of CSIPSubscriptionStateHeader
58 * @param aSubStateValue a substate-value value
59 * @return a new instance of CSIPSubscriptionStateHeader
61 IMPORT_C static CSIPSubscriptionStateHeader*
62 NewL(const TDesC8& aSubStateValue);
65 * Creates a new instance of CSIPSubscriptionStateHeader
66 * and puts it to CleanupStack
67 * @param aSubStateValue a substate-value value
68 * @return a new instance of CSIPSubscriptionStateHeader
70 IMPORT_C static CSIPSubscriptionStateHeader*
71 NewLC(const TDesC8& aSubStateValue);
74 * Destructor, deletes the resources of CSIPSubscriptionStateHeader.
76 IMPORT_C ~CSIPSubscriptionStateHeader();
79 public: // New functions
82 * Gets the substate-value parameter from the "Subscription-State" header
83 * @return the substate-value parameter
85 IMPORT_C const TDesC8& SubStateValue() const;
88 * Sets the substate-value parameter in the "Subscription-State" header;
89 * @param aSubStateValue a substate-value parameter to set
91 IMPORT_C void SetSubStateValueL(const TDesC8& aSubStateValue);
94 * Gets the value of the "expires"-parameter
95 * @return "expires"-parameter or KErrNotFound if not present
97 IMPORT_C TInt ExpiresParameter() const;
100 * Sets the "expires"-parameter
101 * @pre aExpiresParam >= 0
102 * @param aExpiresParam a "expires"-parameter value to set
104 IMPORT_C void SetExpiresParameterL(TInt aExpiresParam);
107 * Gets the value of the "retry-after"-parameter
108 * @return "retry-after"-parameter or KErrNotFound if not present
110 IMPORT_C TInt RetryAfterParameter() const;
113 * Sets the "retry-after"-parameter
114 * @pre aRetryAfterParam >= 0
115 * @param aRetryAfterParam a "retry-after"-parameter value to set
117 IMPORT_C void SetRetryAfterParameterL(TInt aRetryAfterParam);
120 * Constructs an instance of a CSIPSubscriptionStateHeader
122 * @param aReadStream a stream containing the value of the
123 * externalized object (header name not included).
124 * @return an instance of a CSIPSubscriptionStateHeader
126 IMPORT_C static CSIPHeaderBase*
127 InternalizeValueL(RReadStream& aReadStream);
130 public: // From CSIPHeaderBase
133 * From CSIPHeaderBase CloneL
135 IMPORT_C CSIPHeaderBase* CloneL() const;
138 * From CSIPHeaderBase Name
140 IMPORT_C RStringF Name() const;
143 public: // From CSIPHeaderBase, for internal use
148 TPreferredPlace PreferredPlaceInMessage() const;
150 public: // New functions, for internal use
152 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
154 private: // From CSIPHeaderBase
156 void ExternalizeValueL(RWriteStream& aWriteStream) const;
158 private: // From CSIPParameterHeaderBase
160 HBufC8* ToTextMandatoryPartLC() const;
161 void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
162 const CSIPParamContainerBase& Params() const;
163 CSIPParamContainerBase& Params();
165 private: // Constructors
167 CSIPSubscriptionStateHeader();
169 void ConstructL(const TDesC8& aSubStateValue);
170 void ConstructL (const CSIPSubscriptionStateHeader&
171 aSubscriptionStateHeader);
173 private: // New functions
175 void DoInternalizeValueL(RReadStream& aReadStream);
179 HBufC8* iSubStateValue;
180 CSIPSubscriptionStateHeaderParams* iParams;
182 private: // For testing purposes
184 friend class CSIPSubscriptionStateHeaderTest;
189 #endif // CSIPSUBSCRIPTIONSTATEHEADER_H