epoc32/include/mw/sipsubscriptionstateheader.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
equal deleted inserted replaced
2:2fe1408b6811 3:e1b950c65cb4
       
     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        : sipsubscriptionstateheader.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 CSIPSUBSCRIPTIONSTATEHEADER_H
       
    26 #define CSIPSUBSCRIPTIONSTATEHEADER_H
       
    27 
       
    28 //  INCLUDES
       
    29 #include "sipparameterheaderbase.h"
       
    30 #include "_sipcodecdefs.h"
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 class CSIPSubscriptionStateHeaderParams;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /**
       
    37 * @publishedAll
       
    38 * @released
       
    39 *
       
    40 * Class provides functions for setting and getting SIP "Subscription-State"
       
    41 * header fields.
       
    42 *
       
    43 *  @lib sipcodec.lib
       
    44 */
       
    45 class CSIPSubscriptionStateHeader : public CSIPParameterHeaderBase
       
    46 	{
       
    47 	public:	// Constructors and destructor
       
    48 
       
    49 		/**
       
    50 		* Constructs a CSIPSubscriptionStateHeader from textual representation 
       
    51 		* of the header's value part.
       
    52 		* @param aValue a value part of a "Subscription-State"-header
       
    53 		* @return a new instance of CSIPSubscriptionStateHeader
       
    54 		*/
       
    55 		IMPORT_C static CSIPSubscriptionStateHeader* DecodeL(const TDesC8& aValue);
       
    56 
       
    57 		/**
       
    58 		* Creates a new instance of CSIPSubscriptionStateHeader
       
    59 		* @param aSubStateValue a substate-value value
       
    60 		* @return a new instance of CSIPSubscriptionStateHeader
       
    61 		*/
       
    62 		IMPORT_C static CSIPSubscriptionStateHeader* 
       
    63 			NewL(const TDesC8& aSubStateValue);
       
    64 
       
    65 		/**
       
    66 		* Creates a new instance of CSIPSubscriptionStateHeader 
       
    67 		* and puts it to CleanupStack
       
    68 		* @param aSubStateValue a substate-value value
       
    69 		* @return a new instance of CSIPSubscriptionStateHeader
       
    70 		*/
       
    71 		IMPORT_C static CSIPSubscriptionStateHeader* 
       
    72 			NewLC(const TDesC8& aSubStateValue);
       
    73 
       
    74 		/**
       
    75 		* Destructor, deletes the resources of CSIPSubscriptionStateHeader.
       
    76 		*/
       
    77 		IMPORT_C ~CSIPSubscriptionStateHeader();
       
    78 
       
    79 
       
    80 	public: // New functions
       
    81 	
       
    82 		/**
       
    83 		* Gets the substate-value parameter from the "Subscription-State" header
       
    84 		* @return the substate-value parameter
       
    85 		*/
       
    86 		IMPORT_C const TDesC8& SubStateValue() const;
       
    87 
       
    88 		/**
       
    89 		* Sets the substate-value parameter in the "Subscription-State" header; 
       
    90 		* @param aSubStateValue a substate-value parameter to set
       
    91 		*/
       
    92 		IMPORT_C void SetSubStateValueL(const TDesC8& aSubStateValue);
       
    93 
       
    94 		/**
       
    95 		* Gets the value of the "expires"-parameter
       
    96 		* @return "expires"-parameter or KErrNotFound if not present
       
    97 		*/
       
    98 		IMPORT_C TInt ExpiresParameter() const;
       
    99 
       
   100 		/**
       
   101 		* Sets the "expires"-parameter
       
   102 		* @pre aExpiresParam >= 0
       
   103 		* @param aExpiresParam a "expires"-parameter value to set
       
   104 		*/
       
   105 		IMPORT_C void SetExpiresParameterL(TInt aExpiresParam);
       
   106 
       
   107 		/**
       
   108 		* Gets the value of the "retry-after"-parameter
       
   109 		* @return "retry-after"-parameter or KErrNotFound if not present
       
   110 		*/
       
   111 		IMPORT_C TInt RetryAfterParameter() const;
       
   112 
       
   113 		/**
       
   114 		* Sets the "retry-after"-parameter
       
   115 		* @pre aRetryAfterParam >= 0
       
   116 		* @param aRetryAfterParam a "retry-after"-parameter value to set
       
   117 		*/
       
   118 		IMPORT_C void SetRetryAfterParameterL(TInt aRetryAfterParam);
       
   119 	
       
   120 		/**
       
   121 		* Constructs an instance of a CSIPSubscriptionStateHeader 
       
   122 		* from a RReadStream
       
   123 		* @param aReadStream a stream containing the value of the
       
   124 		*        externalized object (header name not included). 
       
   125 		* @return an instance of a CSIPSubscriptionStateHeader
       
   126 		*/
       
   127 		IMPORT_C static CSIPHeaderBase* 
       
   128 			InternalizeValueL(RReadStream& aReadStream);
       
   129 
       
   130 
       
   131 	public: // From CSIPHeaderBase
       
   132 		
       
   133 		/**
       
   134 		* From CSIPHeaderBase CloneL
       
   135 		*/
       
   136 		IMPORT_C CSIPHeaderBase* CloneL() const;
       
   137 
       
   138 		/**
       
   139 		* From CSIPHeaderBase Name
       
   140 		*/
       
   141 		IMPORT_C RStringF Name() const;
       
   142 
       
   143 
       
   144 	public: // From CSIPHeaderBase, for internal use
       
   145 
       
   146         /**
       
   147         * @internalComponent
       
   148         */
       
   149 		TPreferredPlace PreferredPlaceInMessage() const;
       
   150 	
       
   151 	public: // New functions, for internal use
       
   152 
       
   153 		static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
       
   154 
       
   155 	private: // From CSIPHeaderBase
       
   156 
       
   157 		void ExternalizeValueL(RWriteStream& aWriteStream) const;
       
   158 
       
   159 	private: // From CSIPParameterHeaderBase
       
   160 
       
   161 		HBufC8* ToTextMandatoryPartLC() const;
       
   162 		void ParseMandatoryPartL(const TDesC8& aMandatoryPart);
       
   163 		const CSIPParamContainerBase& Params() const;
       
   164 		CSIPParamContainerBase& Params();
       
   165 
       
   166 	private: // Constructors
       
   167 
       
   168 		CSIPSubscriptionStateHeader();
       
   169 		void ConstructL();
       
   170 		void ConstructL(const TDesC8& aSubStateValue);
       
   171         void ConstructL (const CSIPSubscriptionStateHeader&
       
   172             aSubscriptionStateHeader);
       
   173 	
       
   174 	private: // New functions 
       
   175 
       
   176 		void DoInternalizeValueL(RReadStream& aReadStream);
       
   177 
       
   178 	private: // Data
       
   179 
       
   180 		HBufC8* iSubStateValue;
       
   181 		CSIPSubscriptionStateHeaderParams* iParams;
       
   182 
       
   183 	private: // For testing purposes
       
   184 	
       
   185 		UNIT_TEST(CSIPSubscriptionStateHeaderTest)
       
   186 	};
       
   187 
       
   188 
       
   189 #endif // CSIPSUBSCRIPTIONSTATEHEADER_H
       
   190 
       
   191 // End of File