2 * Copyright (c) 2006-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 : sipauthheaderbase.h
23 #ifndef CSIPAUTHHEADERBASE_H
24 #define CSIPAUTHHEADERBASE_H
27 #include "sipheaderbase.h"
28 #include "_sipcodecdefs.h"
30 // FORWARD DECLARATIONS
31 class CSIPParamContainerBase;
38 * A base class for SIP Authorization-, Proxy-Authenticate-,
39 * Proxy-Authorization- and WWW-Authenticate-headers
43 class CSIPAuthHeaderBase : public CSIPHeaderBase
45 public: // Constructors and destructor
50 IMPORT_C virtual ~CSIPAuthHeaderBase();
53 public: // New functions
56 * @return the value of the auth-scheme
58 IMPORT_C RStringF AuthScheme() const;
61 * Checks if a parameter is present
62 * @param aName the name of the parameter
63 * @return ETrue if present, otherwise EFalse
65 IMPORT_C TBool HasParam(RStringF aName) const;
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.
74 IMPORT_C RStringF ParamValue(RStringF aName) const;
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.
83 IMPORT_C const TDesC8& DesParamValue(RStringF aName) const;
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
94 IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
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
107 IMPORT_C void SetDesParamL(RStringF aName, const TDesC8& aValue);
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
120 IMPORT_C void SetParamAndAddQuotesL(RStringF aName,
121 const TDesC8& aValue);
124 * Deletes a parameter
125 * @param aName the parameter name to delete
127 IMPORT_C void DeleteParam(RStringF aName);
130 public: // From CSIPHeaderBase
133 * From CSIPHeaderBase ExternalizeSupported
135 IMPORT_C virtual TBool ExternalizeSupported() const;
138 public: // From CSIPHeaderBase, for internal use
140 TBool EncodeMultipleToOneLine() const;
141 TBool MoreThanOneAllowed() const;
142 TPreferredPlace PreferredPlaceInMessage() const;
143 virtual HBufC8* ToTextValueL() const;
145 protected: // Constructors
147 CSIPAuthHeaderBase();
148 void ConstructL(RStringF aAuthScheme);
150 protected: // New functions
152 void SetAuthSchemeL(const TDesC8& aAuthScheme);
153 void ParseL(const TDesC8& aValue);
154 virtual const CSIPParamContainerBase& Params() const = 0;
155 virtual CSIPParamContainerBase& Params() = 0;
159 RStringF iAuthScheme;
163 #endif // CSIPAUTHHEADERBASE_H