realtimenetprots/sipfw/SIP/Codec/api/siptimestampheader.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          : siptimestampheader.h
       
    16 * Part of       : SIP Codec
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CSIPTIMESTAMPHEADER_H
       
    25 #define CSIPTIMESTAMPHEADER_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include "sipheaderbase.h"
       
    29 
       
    30 // CLASS DECLARATION
       
    31 /**
       
    32 * @publishedAll
       
    33 * @released
       
    34 *
       
    35 * Class for a SIP Timestamp header.
       
    36 *
       
    37 * @lib sipcodec.lib
       
    38 */
       
    39 class CSIPTimestampHeader : public CSIPHeaderBase
       
    40 	{
       
    41 	public:	// Constructors and destructor
       
    42 
       
    43 		/**
       
    44 		* Constructs a CSIPTimestampHeader from textual representation 
       
    45 		* of the header's value part.
       
    46 		* @param aValue a value part of a "Timestamp"-header (e.g. "12 3.4")
       
    47 		* @returns a new instance of CSIPTimestampHeader
       
    48 		*/
       
    49 		IMPORT_C static CSIPTimestampHeader* DecodeL(const TDesC8& aValue);
       
    50 
       
    51         /**
       
    52 		* Constructor
       
    53         * @param aTimestamp a timestamp value to set.
       
    54         * @param aDealy a delay value to set.
       
    55 		*/
       
    56 		IMPORT_C CSIPTimestampHeader(TReal aTimestamp);
       
    57 
       
    58         /**
       
    59 		* Destructor
       
    60 		*/
       
    61 		IMPORT_C ~CSIPTimestampHeader ();
       
    62 
       
    63 
       
    64 	public: // New functions
       
    65 
       
    66         /**
       
    67         * Set the timestamp from the "Timestamp" header.
       
    68         * @param aTimestamp a timestamp to set.
       
    69         */
       
    70         IMPORT_C void SetTimestamp(TReal aTimestamp);
       
    71 
       
    72         /**
       
    73         * Gets the timestamp from the "Timestamp" header.
       
    74         * @return a timestamp value.
       
    75         */
       
    76         IMPORT_C TReal Timestamp() const;
       
    77 
       
    78         /**
       
    79         * Check if the delay-part is present
       
    80         * @return a delay value.
       
    81         */
       
    82         IMPORT_C TBool HasDelay() const;
       
    83 
       
    84         /**
       
    85         * Set the delay-part of the "Timestamp" header.
       
    86         * @param aDelay a delay to set.
       
    87         */
       
    88         IMPORT_C void SetDelay(TReal aDelay);
       
    89 
       
    90         /**
       
    91         * Gets the delay-part of the "Timestamp" header, 
       
    92         * if delay-part is present
       
    93         * @return a delay value or zero if HasDelay() == EFalse
       
    94         */
       
    95         IMPORT_C TReal Delay() const;
       
    96 
       
    97 		/**
       
    98 		* Constructs an instance of a CSIPTimestampHeader from a RReadStream
       
    99 		* @param aReadStream a stream containing the value of the
       
   100 		*	     externalized object (header name not included). 
       
   101 		* @return an instance of a CSIPTimestampHeader
       
   102 		*/
       
   103 		IMPORT_C static CSIPHeaderBase* 
       
   104 			InternalizeValueL(RReadStream& aReadStream);
       
   105 
       
   106 	public: // From CSIPHeaderBase
       
   107 
       
   108 		/**
       
   109 		* From CSIPHeaderBase CloneL
       
   110 		*/
       
   111 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   112 		
       
   113 		/**
       
   114 		* From CSIPHeaderBase Name
       
   115 		*/		
       
   116 		IMPORT_C RStringF Name() const;
       
   117 
       
   118 		/**
       
   119 		* From CSIPHeaderBase ToTextValueL
       
   120 		*/
       
   121 		IMPORT_C HBufC8* ToTextValueL() const;
       
   122 
       
   123 
       
   124 	public: // From CSIPHeaderBase, for internal use
       
   125 
       
   126         /**
       
   127         * @internalComponent
       
   128         */	
       
   129 		TPreferredPlace PreferredPlaceInMessage() const;
       
   130 
       
   131 	public: // New functions, for internal use
       
   132 
       
   133 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   134 
       
   135 	private: // From CSIPHeaderBase
       
   136 
       
   137 		void ExternalizeValueL (RWriteStream& aWriteStream) const;
       
   138 
       
   139 	private: // New functions
       
   140 
       
   141 		void ParseL(const TDesC8& aValue);
       
   142         void DoInternalizeValueL(RReadStream& aReadStream);
       
   143 
       
   144 	private: // Data
       
   145 
       
   146 		TReal iTimestamp;
       
   147         TBool iHasDelay;
       
   148         TReal iDelay;
       
   149 
       
   150 	private: // For testing purposes
       
   151 #ifdef CPPUNIT_TEST	
       
   152 		friend class CSIPTimestampHeaderTest;
       
   153 #endif
       
   154 	};
       
   155 
       
   156 
       
   157 #endif // end of CSIPTIMESTAMPHEADER_H
       
   158 
       
   159 // End of File