epoc32/include/sipcseqheader.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 sipcseqheader.h
     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 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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name        : sipcseqheader.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 CSIPCSEQHEADER_H
       
    26 #define CSIPCSEQHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipheaderbase.h"
       
    30 #include "_sipcodecdefs.h"
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 * @publishedAll
       
    35 * @released
       
    36 *
       
    37 * Class provides functions for setting and getting sequence number and
       
    38 * method in SIP "CSeq" header.
       
    39 *
       
    40 *  @lib sipcodec.lib
       
    41 */
       
    42 class CSIPCSeqHeader : public CSIPHeaderBase
       
    43 	{
       
    44 	public: // Constructors and destructor
       
    45 
       
    46 		/**
       
    47 		* Constructs a CSIPCSeqHeader from textual representation 
       
    48 		* of the header's value part.
       
    49 		* @param aValue a value part of a "CSeq"-header (e.g. "1 REGISTER")
       
    50 		* @return a new instance of CSIPCSeqHeader.  
       
    51 		*/
       
    52 		IMPORT_C static CSIPCSeqHeader* DecodeL(const TDesC8& aValue);
       
    53 
       
    54 		/**
       
    55 		* Creates a new instance of CSIPCSeqHeader
       
    56 		* @param aSeq a sequence number to set.
       
    57 		* @param aMethod a method to set. For example "REGISTER"
       
    58 		* @return a new instance of CSIPCSeqHeader
       
    59 		*/
       
    60 		IMPORT_C static CSIPCSeqHeader* NewL(TUint aSeq, RStringF aMethod);
       
    61 
       
    62 		/**
       
    63 		* Creates a new instance of CSIPCSeqHeader and puts it to CleanupStack
       
    64 		* @param aSeq a sequence number to set.
       
    65 		* @param aMethod a method to set. For example "REGISTER"
       
    66 		* @return a new instance of CSIPCSeqHeader
       
    67 		*/
       
    68 		IMPORT_C static CSIPCSeqHeader* NewLC(TUint aSeq, RStringF aMethod);
       
    69 
       
    70 		/**
       
    71 		* Destructor, deletes the resources of CSIPCSeqHeader.
       
    72 		*/
       
    73 		IMPORT_C ~CSIPCSeqHeader();
       
    74 
       
    75 
       
    76 	public: // New functions
       
    77 
       
    78 		/**
       
    79 		* Gets the sequence number from the "CSeq" header
       
    80 		* @return the current sequence number
       
    81 		*/
       
    82 		IMPORT_C TUint Seq() const;
       
    83 
       
    84 		/**
       
    85 		* Sets the sequence number in the "CSeq" header
       
    86 		* @param aSeq a sequence number to set
       
    87 		*/
       
    88 		IMPORT_C void SetSeq(TUint aSeq);
       
    89 
       
    90 		/**
       
    91 		* Gets the method from the "CSeq" header
       
    92 		* @return the method 
       
    93 		*/
       
    94 		IMPORT_C RStringF Method() const;
       
    95 
       
    96 		/**
       
    97 		* Sets the method in the "CSeq" header
       
    98 		* @param aMethod a method to set
       
    99 		*/
       
   100 		IMPORT_C void SetMethodL(RStringF aMethod);
       
   101 
       
   102 		/**
       
   103 		* Constructs an instance of a CSIPCSeqHeader from a RReadStream
       
   104 		* @param aReadStream a stream containing the value of the
       
   105 		*	     externalized object (header name not included). 
       
   106 		* @return an instance of a CSIPCSeqHeader
       
   107 		*/
       
   108 		IMPORT_C static CSIPHeaderBase* 
       
   109 			InternalizeValueL(RReadStream& aReadStream);
       
   110 
       
   111 
       
   112 	public: // From CSIPHeaderBase
       
   113 
       
   114 		/**
       
   115 		* From CSIPHeaderBase CloneL
       
   116 		*/
       
   117 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   118 
       
   119 		/**
       
   120 		* From CSIPHeaderBase Name
       
   121 		*/
       
   122 		IMPORT_C RStringF Name() const;
       
   123 
       
   124 		/**
       
   125 		* From CSIPHeaderBase ToTextValueL
       
   126 		*/
       
   127 		IMPORT_C HBufC8* ToTextValueL() const;
       
   128 
       
   129 
       
   130 	public: // From CSIPHeaderBase, for internal use
       
   131 
       
   132         /**
       
   133         * @internalComponent
       
   134         */
       
   135 		TPreferredPlace PreferredPlaceInMessage () const;
       
   136 
       
   137 	public: // New functions, for internal use
       
   138 
       
   139 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   140 
       
   141 	private: // From CSIPHeaderBase
       
   142 
       
   143 		void ExternalizeValueL (RWriteStream& aWriteStream) const;
       
   144 
       
   145 	private: // Constructors
       
   146 
       
   147 		CSIPCSeqHeader();
       
   148 		void ConstructL(TUint aCSeq, RStringF aMethod);
       
   149 	
       
   150 	private: // New functions
       
   151 		
       
   152 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   153 		void ParseL(const TDesC8& aValue);
       
   154 		void SetMethodL(const TDesC8& aMethod);
       
   155 
       
   156 	private: // Data
       
   157 
       
   158 		TUint iSeq;
       
   159 		RStringF iMethod;
       
   160 
       
   161 	private: // For testing purposes
       
   162 	
       
   163 		UNIT_TEST(CSIPCSeqHeaderTest)
       
   164 	};
       
   165 
       
   166 #endif // CSIPCSEQHEADER_H
       
   167 
       
   168 // End of File