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 "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 : sipauthheaderbase.h
23 #ifndef CSIPAUTHHEADERBASE_H
24 #define CSIPAUTHHEADERBASE_H
27 #include "sipheaderbase.h"
29 // FORWARD DECLARATIONS
30 class CSIPParamContainerBase;
37 * A base class for SIP Authorization-, Proxy-Authenticate-,
38 * Proxy-Authorization- and WWW-Authenticate-headers
42 class CSIPAuthHeaderBase : public CSIPHeaderBase
44 public: // Constructors and destructor
49 IMPORT_C virtual ~CSIPAuthHeaderBase();
52 public: // New functions
55 * @return the value of the auth-scheme
57 IMPORT_C RStringF AuthScheme() const;
60 * Checks if a parameter is present
61 * @param aName the name of the parameter
62 * @return ETrue if present, otherwise EFalse
64 IMPORT_C TBool HasParam(RStringF aName) const;
67 * Gets a parameter value
68 * @pre HasParam(aName) == ETrue
69 * @param aName the name of the parameter
70 * @return the parameter value if present,
71 * otherwise a zero-length length value.
73 IMPORT_C RStringF ParamValue(RStringF aName) const;
76 * Gets a parameter value stored as a descriptor
77 * @pre HasParam(aName) == ETrue
78 * @param aName the name of the parameter
79 * @return the parameter value if present,
80 * otherwise a zero-length length value.
82 IMPORT_C const TDesC8& DesParamValue(RStringF aName) const;
85 * Sets a parameter with a value.
86 * Takes copies of the name and value,
87 * so if the RStringFs have been dynamically allocated,
88 * they can be closed if necessary after the function returns.
89 * @pre HasParam(aName) == EFalse
90 * @param aName the name of the parameter
91 * @param aValue the parameter value to set
93 IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
96 * Sets a parameter with a value.
97 * Takes copies of the name
98 * so if the RStringF have been dynamically allocated,
99 * they can be closed if necessary after the function returns.
100 * Stores the parameter value as a descriptor, so that the
101 * case-sensitivity is not lost in RStringF-descriptor conversions.
102 * @pre HasParam(aName) == EFalse
103 * @param aName the name of the parameter
104 * @param aValue the parameter value to set
106 IMPORT_C void SetDesParamL(RStringF aName, const TDesC8& aValue);
109 * Sets a parameter with a value and adds double quotes
110 * as the first and the last character in the value.
111 * Takes copy of the name,
112 * so if the RStringF has been dynamically allocated,
113 * it can be closed if necessary after the function returns.
114 * @pre HasParam(aName) == EFalse
115 * @param aName the name of the parameter
116 * @param aValue the parameter value
117 * to which the double quotes will be added
119 IMPORT_C void SetParamAndAddQuotesL(RStringF aName,
120 const TDesC8& aValue);
123 * Deletes a parameter
124 * @param aName the parameter name to delete
126 IMPORT_C void DeleteParam(RStringF aName);
129 public: // From CSIPHeaderBase
132 * From CSIPHeaderBase ExternalizeSupported
134 IMPORT_C virtual TBool ExternalizeSupported() const;
137 public: // From CSIPHeaderBase, for internal use
139 TBool EncodeMultipleToOneLine() const;
140 TBool MoreThanOneAllowed() const;
141 TPreferredPlace PreferredPlaceInMessage() const;
142 virtual HBufC8* ToTextValueL() const;
144 protected: // Constructors
146 CSIPAuthHeaderBase();
147 void ConstructL(RStringF aAuthScheme);
149 protected: // New functions
151 void SetAuthSchemeL(const TDesC8& aAuthScheme);
152 void ParseL(const TDesC8& aValue);
153 virtual const CSIPParamContainerBase& Params() const = 0;
154 virtual CSIPParamContainerBase& Params() = 0;
158 RStringF iAuthScheme;
162 #endif // CSIPAUTHHEADERBASE_H