|
1 /* |
|
2 * Copyright (c) 2006-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 : sipauthheaderbase.h |
|
16 * Part of : SIP Codec |
|
17 * Version : SIP/5.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 #ifndef CSIPAUTHHEADERBASE_H |
|
24 #define CSIPAUTHHEADERBASE_H |
|
25 |
|
26 // INCLUDES |
|
27 #include "sipheaderbase.h" |
|
28 #include "_sipcodecdefs.h" |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CSIPParamContainerBase; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * @publishedAll |
|
36 * @released |
|
37 * |
|
38 * A base class for SIP Authorization-, Proxy-Authenticate-, |
|
39 * Proxy-Authorization- and WWW-Authenticate-headers |
|
40 * |
|
41 * @lib sipcodec.lib |
|
42 */ |
|
43 class CSIPAuthHeaderBase : public CSIPHeaderBase |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 IMPORT_C virtual ~CSIPAuthHeaderBase(); |
|
51 |
|
52 |
|
53 public: // New functions |
|
54 |
|
55 /** |
|
56 * @return the value of the auth-scheme |
|
57 */ |
|
58 IMPORT_C RStringF AuthScheme() const; |
|
59 |
|
60 /** |
|
61 * Checks if a parameter is present |
|
62 * @param aName the name of the parameter |
|
63 * @return ETrue if present, otherwise EFalse |
|
64 */ |
|
65 IMPORT_C TBool HasParam(RStringF aName) const; |
|
66 |
|
67 /** |
|
68 * Gets a parameter value |
|
69 * @pre HasParam(aName) == ETrue |
|
70 * @param aName the name of the parameter |
|
71 * @return the parameter value if present, |
|
72 * otherwise a zero-length length value. |
|
73 */ |
|
74 IMPORT_C RStringF ParamValue(RStringF aName) const; |
|
75 |
|
76 /** |
|
77 * Gets a parameter value stored as a descriptor |
|
78 * @pre HasParam(aName) == ETrue |
|
79 * @param aName the name of the parameter |
|
80 * @return the parameter value if present, |
|
81 * otherwise a zero-length length value. |
|
82 */ |
|
83 IMPORT_C const TDesC8& DesParamValue(RStringF aName) const; |
|
84 |
|
85 /** |
|
86 * Sets a parameter with a value. |
|
87 * Takes copies of the name and value, |
|
88 * so if the RStringFs have been dynamically allocated, |
|
89 * they can be closed if necessary after the function returns. |
|
90 * @pre HasParam(aName) == EFalse |
|
91 * @param aName the name of the parameter |
|
92 * @param aValue the parameter value to set |
|
93 */ |
|
94 IMPORT_C void SetParamL(RStringF aName, RStringF aValue); |
|
95 |
|
96 /** |
|
97 * Sets a parameter with a value. |
|
98 * Takes copies of the name |
|
99 * so if the RStringF have been dynamically allocated, |
|
100 * they can be closed if necessary after the function returns. |
|
101 * Stores the parameter value as a descriptor, so that the |
|
102 * case-sensitivity is not lost in RStringF-descriptor conversions. |
|
103 * @pre HasParam(aName) == EFalse |
|
104 * @param aName the name of the parameter |
|
105 * @param aValue the parameter value to set |
|
106 */ |
|
107 IMPORT_C void SetDesParamL(RStringF aName, const TDesC8& aValue); |
|
108 |
|
109 /** |
|
110 * Sets a parameter with a value and adds double quotes |
|
111 * as the first and the last character in the value. |
|
112 * Takes copy of the name, |
|
113 * so if the RStringF has been dynamically allocated, |
|
114 * it can be closed if necessary after the function returns. |
|
115 * @pre HasParam(aName) == EFalse |
|
116 * @param aName the name of the parameter |
|
117 * @param aValue the parameter value |
|
118 * to which the double quotes will be added |
|
119 */ |
|
120 IMPORT_C void SetParamAndAddQuotesL(RStringF aName, |
|
121 const TDesC8& aValue); |
|
122 |
|
123 /** |
|
124 * Deletes a parameter |
|
125 * @param aName the parameter name to delete |
|
126 */ |
|
127 IMPORT_C void DeleteParam(RStringF aName); |
|
128 |
|
129 |
|
130 public: // From CSIPHeaderBase |
|
131 |
|
132 /** |
|
133 * From CSIPHeaderBase ExternalizeSupported |
|
134 */ |
|
135 IMPORT_C virtual TBool ExternalizeSupported() const; |
|
136 |
|
137 |
|
138 public: // From CSIPHeaderBase, for internal use |
|
139 |
|
140 TBool EncodeMultipleToOneLine() const; |
|
141 TBool MoreThanOneAllowed() const; |
|
142 TPreferredPlace PreferredPlaceInMessage() const; |
|
143 virtual HBufC8* ToTextValueL() const; |
|
144 |
|
145 protected: // Constructors |
|
146 |
|
147 CSIPAuthHeaderBase(); |
|
148 void ConstructL(RStringF aAuthScheme); |
|
149 |
|
150 protected: // New functions |
|
151 |
|
152 void SetAuthSchemeL(const TDesC8& aAuthScheme); |
|
153 void ParseL(const TDesC8& aValue); |
|
154 virtual const CSIPParamContainerBase& Params() const = 0; |
|
155 virtual CSIPParamContainerBase& Params() = 0; |
|
156 |
|
157 private: // Data |
|
158 |
|
159 RStringF iAuthScheme; |
|
160 TChar iSeparator; |
|
161 }; |
|
162 |
|
163 #endif // CSIPAUTHHEADERBASE_H |
|
164 |
|
165 // End of File |