realtimenetprots/sipfw/SIP/Codec/inc/SIPHeaderLookup.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          : SIPHeaderLookup.h
       
    16 * Part of       : SIP Codec
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 
       
    29 #ifndef SIPHEADERLOOKUP_H
       
    30 #define SIPHEADERLOOKUP_H
       
    31 
       
    32 //  INCLUDES
       
    33 #include <e32std.h>
       
    34 #include <s32mem.h>
       
    35 #include "sipheaderbase.h"
       
    36 #include "_sipcodecdefs.h"
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CSIPHeaderLookupTable;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 /**
       
    43 * A class for generic header construction.
       
    44 *
       
    45 * @lib sipcodec.lib
       
    46 */
       
    47 class SIPHeaderLookup
       
    48 	{
       
    49 	public:	// Constructors and destructor
       
    50 	
       
    51 		/**
       
    52 		* Opens a SIP header lookup. 
       
    53 		* Implemented with a reference count.
       
    54 		*/
       
    55 		IMPORT_C static void OpenL();
       
    56 
       
    57 		/**
       
    58 		* Closes a SIP header lookup.
       
    59 		* In other words decrements reference count and if it reaches
       
    60 		* zero, closes the header lookup.	 
       
    61 		* The user must not call Close() if it has not called OpenL().
       
    62 		*/
       
    63 		IMPORT_C static void Close();
       
    64 	
       
    65 
       
    66 	public: // New functions
       
    67 
       
    68 		/**
       
    69 		* Tells if a SIP header is supported as an explicit class.
       
    70 		* (Not only as an extension header).
       
    71 		* @param aName the name of the header
       
    72 		* @returns ETrue if a given header is supported, otherwise EFalse
       
    73 		*/
       
    74 		IMPORT_C static TBool IsSupported(RStringF aName);	
       
    75 	
       
    76 		/**
       
    77 		* Internalizes a header with a given name.
       
    78 		* @pre aHeaderName.Length()>0
       
    79 		* @param aName the name of the header
       
    80 		* @param aReadStream the stream from where to internalize
       
    81 		* @returns 0, if internalizing for the given header is not supported,
       
    82 		*          otherwise the internalized header.
       
    83 		*/
       
    84 		IMPORT_C static CSIPHeaderBase* 
       
    85 			InternalizeL(RStringF aName, RReadStream& aReadStream);
       
    86 
       
    87 		/**
       
    88 		* Checks if the header is part of the public SIP API as a non-extension.
       
    89 		* @param aName the name of the header
       
    90 		* @returns ETrue if supported, otherwise EFalse.
       
    91 		*/
       
    92 		IMPORT_C static TBool IsAPIHeader(RStringF aName);
       
    93 
       
    94 		/**
       
    95 		* Decodes SIP header(s).
       
    96 		* @pre aHeaderName.Length()>0
       
    97 		* @param aName the name. For example "To".
       
    98 		* @param aValue the value. For example "User <user@host>"
       
    99 		* @returns An array of headers. Note that the value parameter may contain
       
   100 		*          multiple comma separated header values for those SIP headers
       
   101 		*          that allow this format according to SIP BNF.
       
   102 		*/
       
   103 		IMPORT_C static RPointerArray<CSIPHeaderBase> 
       
   104 			CreateHeaderL(RStringF aName, const TDesC8& aValue);
       
   105 
       
   106 
       
   107 	public: // For internal use
       
   108 
       
   109 		IMPORT_C static void SetConvertToSIPURI(TBool aValue=ETrue);
       
   110 		static TBool ConvertToSIPURI();
       
   111 
       
   112 		
       
   113 	private: // New functions
       
   114 
       
   115 		static CSIPHeaderLookupTable* LookupTable();
       
   116 	};
       
   117 
       
   118 #endif // SIPHEADERLOOKUP_H
       
   119 
       
   120 // End of File