realtimenetprots/sipfw/SIP/Codec/api/sipextensionheader.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     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        : sipextensionheader.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 CSIPEXTENSIONHEADER_H
       
    26 #define CSIPEXTENSIONHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipheaderbase.h"
       
    30 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 * @publishedAll
       
    35 * @released
       
    36 *
       
    37 * The class stores unknown and extension headers that are either not 
       
    38 * supported by the current SIP codec implementation or not specified in
       
    39 * current SIP RFC or both.
       
    40 *
       
    41 *  @lib sipcodec.lib
       
    42 */
       
    43 class CSIPExtensionHeader : public CSIPHeaderBase
       
    44 	{
       
    45 	public:	// Constructors and destructor
       
    46 
       
    47 		/**
       
    48 		* Creates a new instance of CSIPExtensionHeader
       
    49 		* @param aName the full or compact name of the header
       
    50 		* @param aValue the value of the header
       
    51 		* @return a new instance of CSIPExtensionHeader
       
    52 		*/
       
    53 		IMPORT_C static CSIPExtensionHeader* 
       
    54 			NewL(const TDesC8& aName, const TDesC8& aValue);
       
    55 
       
    56 		/**
       
    57 		* Creates a new instance of CSIPExtensionHeader 
       
    58 		* and puts it to CleanupStack
       
    59 		* @param aName the full or compact name of the header
       
    60 		* @param aValue the value of the header
       
    61 		* @return a new instance of CSIPExtensionHeader
       
    62 		*/
       
    63 		IMPORT_C static CSIPExtensionHeader* 
       
    64 			NewLC(const TDesC8& aName, const TDesC8& aValue);
       
    65 
       
    66 		/**
       
    67 		* Destructor, deletes the resources of CSIPExtensionHeader.
       
    68 		*/
       
    69 		IMPORT_C ~CSIPExtensionHeader();
       
    70 
       
    71 
       
    72 	public: // New functions
       
    73 
       
    74 		/**
       
    75 		* Sets the header value
       
    76 		* @param aValue the header value to be set
       
    77 		*/
       
    78 		IMPORT_C void SetValueL(const TDesC8& aValue);
       
    79 
       
    80 		/**
       
    81 		* Gets the header value
       
    82 		* @return the header value
       
    83 		*/
       
    84 		IMPORT_C const TDesC8& Value() const;
       
    85 
       
    86 		/**
       
    87 		* Constructs an instance of a CSIPExtensionHeader from a RReadStream
       
    88 		* @param aReadStream a stream containing the value of the
       
    89 		*        externalized header object (header name not included).
       
    90 		* @return an instance of a CSIPExtensionHeader
       
    91 		*/
       
    92 
       
    93 		IMPORT_C static CSIPExtensionHeader* 
       
    94 			InternalizeValueL(RReadStream& aReadStream);
       
    95 
       
    96 
       
    97 	public: // From CSIPHeaderBase
       
    98 
       
    99 		/**
       
   100 		* From CSIPHeaderBase CloneL
       
   101 		*/
       
   102 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   103 
       
   104 		/**
       
   105 		* From CSIPHeaderBase Name
       
   106 		*/
       
   107 		IMPORT_C RStringF Name() const;
       
   108 
       
   109 		/**
       
   110 		* From CSIPHeaderBase ToTextValueL
       
   111 		*/
       
   112 		IMPORT_C HBufC8* ToTextValueL() const;
       
   113 
       
   114 		/**
       
   115 		* From CSIPHeaderBase ExternalizeSupported
       
   116 		*/
       
   117 		IMPORT_C TBool ExternalizeSupported() const;
       
   118 
       
   119 
       
   120 	public: // New functions, for internal use
       
   121 
       
   122 		void SetNameL(const TDesC8& aName);
       
   123 
       
   124 	public: // From CSIPHeaderBase, for internal use
       
   125 
       
   126         /**
       
   127         * @internalComponent
       
   128         */	
       
   129 		TBool IsExtensionHeader() const;
       
   130 		
       
   131         /**
       
   132         * @internalComponent
       
   133         */		
       
   134 		TBool EncodeMultipleToOneLine() const;
       
   135 		
       
   136         /**
       
   137         * @internalComponent
       
   138         */		
       
   139 		TBool MoreThanOneAllowed() const;
       
   140 		
       
   141         /**
       
   142         * @internalComponent
       
   143         */		
       
   144 		TBool HasCompactName() const;
       
   145 		
       
   146         /**
       
   147         * @internalComponent
       
   148         */		
       
   149 		RStringF CompactName() const;
       
   150 		
       
   151         /**
       
   152         * @internalComponent
       
   153         */		
       
   154 		TPreferredPlace PreferredPlaceInMessage() const;
       
   155 
       
   156 	private: // From CSIPHeaderBase
       
   157 
       
   158 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   159 
       
   160 	private: // Constructors
       
   161 
       
   162 		CSIPExtensionHeader();
       
   163 		void ConstructL(const TDesC8& aName, const TDesC8& aValue);
       
   164 		void ConstructL(const CSIPExtensionHeader& aExtensionHeader);
       
   165 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   166 
       
   167 	private: // New functions
       
   168 
       
   169 		TBool CheckValue (const TDesC8& aValue);
       
   170 	
       
   171 	private: // Data
       
   172 
       
   173 		// data
       
   174 		RStringF iName;
       
   175 		HBufC8* iValue;
       
   176 
       
   177 	private: // For testing purposes
       
   178 #ifdef CPPUNIT_TEST	
       
   179 		friend class CSIPExtensionHeaderTest;
       
   180 		friend class CSIPHeaderLookupTest;
       
   181 #endif
       
   182 	};
       
   183 
       
   184 #endif // CSIPEXTENSIONHEADER_H
       
   185 
       
   186 // End of File