realtimenetprots/sipfw/SIP/Codec/api/siprackheader.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        : siprackheader.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 CSIPRACKHEADER_H
       
    26 #define CSIPRACKHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipheaderbase.h"
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * @publishedAll
       
    34 * @released
       
    35 *
       
    36 * Class provides functions for setting and getting sequence number and
       
    37 * method in SIP "RAck"-header.
       
    38 *
       
    39 *  @lib sipcodec.lib
       
    40 */
       
    41 class CSIPRAckHeader : public CSIPHeaderBase
       
    42 	{
       
    43 	public: // Constructors and destructor
       
    44 
       
    45 		/**
       
    46 		* Constructs a CSIPRAckHeader from textual representation 
       
    47 		* of the header's value part.
       
    48 		* @param aValue a value part of a "RAck"-header (e.g. "1 2 INVITE")
       
    49 		* @return a new instance of CSIPRAckHeader.  
       
    50 		*/
       
    51 		IMPORT_C static CSIPRAckHeader* DecodeL(const TDesC8& aValue);
       
    52 
       
    53 		/**
       
    54 		* Creates a new instance of CSIPRAckHeader
       
    55 		* @param aSeq a sequence number to set
       
    56         * @param aCSeqNum a sequence number from CSeq-header
       
    57 		* @param aMethod a method to set. For example "REGISTER"
       
    58 		* @return a new instance of CSIPRAckHeader
       
    59 		*/
       
    60 		IMPORT_C static CSIPRAckHeader* NewL(TUint aSeq,
       
    61                                              TUint aCSeqNum,
       
    62                                              RStringF aMethod);
       
    63 
       
    64 
       
    65 		/**
       
    66 		* Creates a new instance of CSIPRAckHeader and puts it to CleanupStack
       
    67 		* @param aSeq a sequence number to set
       
    68         * @param aCSeqNum a sequence number from CSeq-header
       
    69 		* @param aMethod a method to set. For example "REGISTER"
       
    70 		* @return a new instance of CSIPRAckHeader
       
    71 		*/
       
    72 		IMPORT_C static CSIPRAckHeader* NewLC(TUint aSeq,
       
    73                                               TUint aCSeqNum,
       
    74                                               RStringF aMethod);
       
    75 
       
    76 		/**
       
    77 		* Destructor, deletes the resources of CSIPRAckHeader.
       
    78 		*/
       
    79 		IMPORT_C ~CSIPRAckHeader();
       
    80 
       
    81 
       
    82 	public: // New functions
       
    83 
       
    84 		/**
       
    85 		* Gets the sequence number from the "RAck" header
       
    86 		* @return the current sequence number
       
    87 		*/
       
    88 		IMPORT_C TUint Seq() const;
       
    89 
       
    90 		/**
       
    91 		* Sets the sequence number in the "RAck" header
       
    92 		* @param aSeq a sequence number to set
       
    93 		*/
       
    94 		IMPORT_C void SetSeq(TUint aSeq);
       
    95 
       
    96 		/**
       
    97 		* Gets the sequence number from the "RAck" header
       
    98 		* @return the current sequence number
       
    99 		*/
       
   100 		IMPORT_C TUint CSeqNum() const;
       
   101 
       
   102 		/**
       
   103 		* Sets the sequence number in the "RAck" header
       
   104 		* @param aCSeqNum a sequence number to set
       
   105 		*/
       
   106 		IMPORT_C void SetCSeqNum(TUint aCSeqNum);
       
   107 
       
   108 		/**
       
   109 		* Gets the method from the "RAck" header
       
   110 		* @return the method 
       
   111 		*/
       
   112 		IMPORT_C RStringF Method() const;
       
   113 
       
   114 		/**
       
   115 		* Sets the method in the "RAck" header
       
   116 		* @param aMethod a method to set
       
   117 		*/
       
   118 		IMPORT_C void SetMethodL(RStringF aMethod);
       
   119 
       
   120 		/**
       
   121 		* Constructs an instance of a CSIPRAckHeader from a RReadStream
       
   122 		* @param aReadStream a stream containing the value of the
       
   123 		*	     externalized object (header name not included). 
       
   124 		* @return an instance of a CSIPRAckHeader
       
   125 		*/
       
   126 		IMPORT_C static CSIPHeaderBase* 
       
   127 			InternalizeValueL(RReadStream& aReadStream);
       
   128 
       
   129 
       
   130 	public: // From CSIPHeaderBase
       
   131 
       
   132 		/**
       
   133 		* From CSIPHeaderBase CloneL
       
   134 		*/
       
   135 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   136 
       
   137 		/**
       
   138 		* From CSIPHeaderBase Name
       
   139 		*/
       
   140 		IMPORT_C RStringF Name() const;
       
   141 
       
   142 		/**
       
   143 		* From CSIPHeaderBase ToTextValueL
       
   144 		*/
       
   145 		IMPORT_C HBufC8* ToTextValueL() const;
       
   146 
       
   147 
       
   148 	public: // From CSIPHeaderBase, for internal use
       
   149 
       
   150         /**
       
   151         * @internalComponent
       
   152         */
       
   153 		TPreferredPlace PreferredPlaceInMessage() const;
       
   154 
       
   155 	public: // New functions, for internal use
       
   156 
       
   157 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   158 
       
   159 	private: // From CSIPHeaderBase
       
   160 
       
   161 		void ExternalizeValueL (RWriteStream& aWriteStream) const;
       
   162 
       
   163 	private: // Constructors
       
   164 
       
   165         CSIPRAckHeader();
       
   166 		CSIPRAckHeader(TUint aSeq, TUint aCSeqNum);
       
   167 		void ConstructL(RStringF aMethod);
       
   168 		void ConstructL(const CSIPRAckHeader& aRAckHeader);
       
   169 	
       
   170 	private: // New functions
       
   171 		
       
   172 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   173 		void ParseL(const TDesC8& aValue);
       
   174 		void SetMethodL(const TDesC8& aMethod);
       
   175 
       
   176 	private: // Data
       
   177 
       
   178 		TUint iSeq;
       
   179         TUint iCSeqNum;
       
   180 		RStringF iMethod;
       
   181 
       
   182 	private: // For testing purposes
       
   183 #ifdef CPPUNIT_TEST	
       
   184 		friend class CSIPRAckHeaderTest;
       
   185 #endif
       
   186 	};
       
   187 
       
   188 #endif // CSIPRACKHEADER_H
       
   189 
       
   190 // End of File