realtimenetprots/sipfw/SIP/Codec/api/sipauthheaderbase.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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 "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          : 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 
       
    29 // FORWARD DECLARATIONS
       
    30 class CSIPParamContainerBase;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 * @publishedAll
       
    35 * @released
       
    36 *
       
    37 * A base class for SIP Authorization-, Proxy-Authenticate-, 
       
    38 * Proxy-Authorization- and WWW-Authenticate-headers
       
    39 *
       
    40 * @lib sipcodec.lib
       
    41 */
       
    42 class CSIPAuthHeaderBase : public CSIPHeaderBase
       
    43 	{
       
    44 	public: // Constructors and destructor
       
    45 
       
    46 		/**
       
    47 		* Destructor.
       
    48 		*/
       
    49 		IMPORT_C virtual ~CSIPAuthHeaderBase();
       
    50 
       
    51 
       
    52 	public:	// New functions
       
    53 
       
    54 		/**
       
    55 		* @return the value of the auth-scheme
       
    56 		*/
       
    57 		IMPORT_C RStringF AuthScheme() const;
       
    58 
       
    59 		/**
       
    60 		* Checks if a parameter is present
       
    61 		* @param aName the name of the parameter
       
    62 		* @return ETrue if present, otherwise EFalse
       
    63 		*/
       
    64 		IMPORT_C TBool HasParam(RStringF aName) const;
       
    65 
       
    66 		/**
       
    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.
       
    72 		*/
       
    73 		IMPORT_C RStringF ParamValue(RStringF aName) const;
       
    74 
       
    75 		/**
       
    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.
       
    81 		*/
       
    82 		IMPORT_C const TDesC8& DesParamValue(RStringF aName) const;
       
    83 
       
    84 		/**
       
    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
       
    92 		*/
       
    93 		IMPORT_C void SetParamL(RStringF aName, RStringF aValue);
       
    94 
       
    95 		/**
       
    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
       
   105 		*/
       
   106 		IMPORT_C void SetDesParamL(RStringF aName, const TDesC8& aValue);
       
   107 
       
   108 		/**
       
   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
       
   118 		*/
       
   119 		IMPORT_C void SetParamAndAddQuotesL(RStringF aName,
       
   120 			                                const TDesC8& aValue);
       
   121 
       
   122 		/**
       
   123 		* Deletes a parameter
       
   124 		* @param aName the parameter name to delete
       
   125 		*/
       
   126 		IMPORT_C void DeleteParam(RStringF aName);
       
   127 
       
   128 
       
   129 	public: // From CSIPHeaderBase
       
   130 
       
   131 		/**
       
   132 		* From CSIPHeaderBase ExternalizeSupported
       
   133 		*/
       
   134 		IMPORT_C virtual TBool ExternalizeSupported() const;
       
   135 
       
   136 
       
   137 	public: // From CSIPHeaderBase, for internal use
       
   138 
       
   139 		TBool EncodeMultipleToOneLine() const;
       
   140 		TBool MoreThanOneAllowed() const;
       
   141 		TPreferredPlace PreferredPlaceInMessage() const;
       
   142         virtual HBufC8* ToTextValueL() const;
       
   143 
       
   144 	protected: // Constructors
       
   145 
       
   146 		CSIPAuthHeaderBase();
       
   147 		void ConstructL(RStringF aAuthScheme);
       
   148 
       
   149 	protected: // New functions
       
   150 
       
   151 		void SetAuthSchemeL(const TDesC8& aAuthScheme);
       
   152         void ParseL(const TDesC8& aValue);
       
   153         virtual const CSIPParamContainerBase& Params() const = 0;
       
   154         virtual CSIPParamContainerBase& Params() = 0;
       
   155 
       
   156 	private: // Data
       
   157 
       
   158 		RStringF iAuthScheme;
       
   159         TChar iSeparator;
       
   160 	};
       
   161 
       
   162 #endif // CSIPAUTHHEADERBASE_H
       
   163 
       
   164 // End of File