|
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 : sipsubscriptionstateheader.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 CSIPSUBSCRIPTIONSTATEHEADER_H |
|
26 #define CSIPSUBSCRIPTIONSTATEHEADER_H |
|
27 |
|
28 // INCLUDES |
|
29 #include "sipparameterheaderbase.h" |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CSIPSubscriptionStateHeaderParams; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * @publishedAll |
|
37 * @released |
|
38 * |
|
39 * Class provides functions for setting and getting SIP "Subscription-State" |
|
40 * header fields. |
|
41 * |
|
42 * @lib sipcodec.lib |
|
43 */ |
|
44 class CSIPSubscriptionStateHeader : public CSIPParameterHeaderBase |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
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 |
|
53 */ |
|
54 IMPORT_C static CSIPSubscriptionStateHeader* DecodeL(const TDesC8& aValue); |
|
55 |
|
56 /** |
|
57 * Creates a new instance of CSIPSubscriptionStateHeader |
|
58 * @param aSubStateValue a substate-value value |
|
59 * @return a new instance of CSIPSubscriptionStateHeader |
|
60 */ |
|
61 IMPORT_C static CSIPSubscriptionStateHeader* |
|
62 NewL(const TDesC8& aSubStateValue); |
|
63 |
|
64 /** |
|
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 |
|
69 */ |
|
70 IMPORT_C static CSIPSubscriptionStateHeader* |
|
71 NewLC(const TDesC8& aSubStateValue); |
|
72 |
|
73 /** |
|
74 * Destructor, deletes the resources of CSIPSubscriptionStateHeader. |
|
75 */ |
|
76 IMPORT_C ~CSIPSubscriptionStateHeader(); |
|
77 |
|
78 |
|
79 public: // New functions |
|
80 |
|
81 /** |
|
82 * Gets the substate-value parameter from the "Subscription-State" header |
|
83 * @return the substate-value parameter |
|
84 */ |
|
85 IMPORT_C const TDesC8& SubStateValue() const; |
|
86 |
|
87 /** |
|
88 * Sets the substate-value parameter in the "Subscription-State" header; |
|
89 * @param aSubStateValue a substate-value parameter to set |
|
90 */ |
|
91 IMPORT_C void SetSubStateValueL(const TDesC8& aSubStateValue); |
|
92 |
|
93 /** |
|
94 * Gets the value of the "expires"-parameter |
|
95 * @return "expires"-parameter or KErrNotFound if not present |
|
96 */ |
|
97 IMPORT_C TInt ExpiresParameter() const; |
|
98 |
|
99 /** |
|
100 * Sets the "expires"-parameter |
|
101 * @pre aExpiresParam >= 0 |
|
102 * @param aExpiresParam a "expires"-parameter value to set |
|
103 */ |
|
104 IMPORT_C void SetExpiresParameterL(TInt aExpiresParam); |
|
105 |
|
106 /** |
|
107 * Gets the value of the "retry-after"-parameter |
|
108 * @return "retry-after"-parameter or KErrNotFound if not present |
|
109 */ |
|
110 IMPORT_C TInt RetryAfterParameter() const; |
|
111 |
|
112 /** |
|
113 * Sets the "retry-after"-parameter |
|
114 * @pre aRetryAfterParam >= 0 |
|
115 * @param aRetryAfterParam a "retry-after"-parameter value to set |
|
116 */ |
|
117 IMPORT_C void SetRetryAfterParameterL(TInt aRetryAfterParam); |
|
118 |
|
119 /** |
|
120 * Constructs an instance of a CSIPSubscriptionStateHeader |
|
121 * from a RReadStream |
|
122 * @param aReadStream a stream containing the value of the |
|
123 * externalized object (header name not included). |
|
124 * @return an instance of a CSIPSubscriptionStateHeader |
|
125 */ |
|
126 IMPORT_C static CSIPHeaderBase* |
|
127 InternalizeValueL(RReadStream& aReadStream); |
|
128 |
|
129 |
|
130 public: // From CSIPHeaderBase |
|
131 |
|
132 /** |
|
133 * From CSIPHeaderBase CloneL |
|
134 */ |
|
135 IMPORT_C CSIPHeaderBase* CloneL() const; |
|
136 |
|
137 /** |
|
138 * From CSIPHeaderBase Name |
|
139 */ |
|
140 IMPORT_C RStringF Name() const; |
|
141 |
|
142 |
|
143 public: // From CSIPHeaderBase, for internal use |
|
144 |
|
145 /** |
|
146 * @internalComponent |
|
147 */ |
|
148 TPreferredPlace PreferredPlaceInMessage() const; |
|
149 |
|
150 public: // New functions, for internal use |
|
151 |
|
152 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue); |
|
153 |
|
154 private: // From CSIPHeaderBase |
|
155 |
|
156 void ExternalizeValueL(RWriteStream& aWriteStream) const; |
|
157 |
|
158 private: // From CSIPParameterHeaderBase |
|
159 |
|
160 HBufC8* ToTextMandatoryPartLC() const; |
|
161 void ParseMandatoryPartL(const TDesC8& aMandatoryPart); |
|
162 const CSIPParamContainerBase& Params() const; |
|
163 CSIPParamContainerBase& Params(); |
|
164 |
|
165 private: // Constructors |
|
166 |
|
167 CSIPSubscriptionStateHeader(); |
|
168 void ConstructL(); |
|
169 void ConstructL(const TDesC8& aSubStateValue); |
|
170 void ConstructL (const CSIPSubscriptionStateHeader& |
|
171 aSubscriptionStateHeader); |
|
172 |
|
173 private: // New functions |
|
174 |
|
175 void DoInternalizeValueL(RReadStream& aReadStream); |
|
176 |
|
177 private: // Data |
|
178 |
|
179 HBufC8* iSubStateValue; |
|
180 CSIPSubscriptionStateHeaderParams* iParams; |
|
181 |
|
182 private: // For testing purposes |
|
183 #ifdef CPPUNIT_TEST |
|
184 friend class CSIPSubscriptionStateHeaderTest; |
|
185 #endif |
|
186 }; |
|
187 |
|
188 |
|
189 #endif // CSIPSUBSCRIPTIONSTATEHEADER_H |
|
190 |
|
191 // End of File |