tsrc/sipclientstub/inc/sipresponseelements.h
changeset 0 f0cf47e981f9
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     1 /*
       
     2 * Copyright (c) 2005 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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CSIPRESPONSEELEMENTS_H
       
    20 #define CSIPRESPONSEELEMENTS_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "musunittesting.h"
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <s32strm.h>
       
    27 #include <stringpool.h>
       
    28 #include "_sipcodecdefs.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CSIPMessageElements;
       
    32 class CSIPFromHeader;
       
    33 class CSIPToHeader;
       
    34 class CSIPCSeqHeader;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  @publishedAll
       
    40 *
       
    41 *  Class provides services for creating and manipulating SIP responses
       
    42 *  This class is used for creating and manipulating SIP responses including
       
    43 *  status code, reason phrase and optional elements such user headers,
       
    44 *  content and its type.
       
    45 *
       
    46 *  @lib sipclient.lib
       
    47 */
       
    48 class CSIPResponseElements : public CBase
       
    49 	{
       
    50     public:  // Constructors and destructor       
       
    51 	    /**
       
    52         * Two-phased constructor.
       
    53         * @pre aStatusCode > 100 && aStatusCode < 700
       
    54 	    * @param aStatusCode a known SIP response status code. Cannot be 100.
       
    55 		* @param aReasonPhrase a SIP response reason phrase.
       
    56         */
       
    57 		IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode,
       
    58 		                                           RStringF aReasonPhrase);
       
    59 										
       
    60 	    /**
       
    61         * Two-phased constructor.
       
    62         * @pre aStatusCode > 100 && aStatusCode < 700
       
    63 	    * @param aStatusCode a known SIP response status code. Cannot be 100.
       
    64 		* @param aReasonPhrase a SIP response reason phrase.
       
    65         */
       
    66 		IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode,
       
    67 		                                            RStringF aReasonPhrase);
       
    68 											
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72 		IMPORT_C ~CSIPResponseElements();
       
    73 
       
    74     public: // New functions
       
    75 		/**
       
    76 		* Sets a SIP Response extension status code. It is not possible to set
       
    77         * value 100.
       
    78         * @pre aStatusCode > 100 && aStatusCode < 700
       
    79 		* @param aStatusCode extension status code
       
    80 		* @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700
       
    81 		*/
       
    82 		IMPORT_C void SetStatusCodeL(TUint aStatusCode);
       
    83 
       
    84 		/**
       
    85 		* Gets the SIP Response status code
       
    86 		* @return SIP Response status code
       
    87 		*/
       
    88 		IMPORT_C TUint StatusCode() const;
       
    89 
       
    90 		/**
       
    91 		* Sets a SIP Response Reason Phrase.
       
    92 		* @param aReasonPhrase a SIP response reason phrase.
       
    93 		*/
       
    94 		IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase);
       
    95 			
       
    96 		/**
       
    97 		* Gets a SIP Response Reason Phrase.
       
    98 		* @return a SIP response reason phrase or an empty string if
       
    99         *   the reason phrase is not defined.
       
   100 		*/
       
   101 		IMPORT_C RStringF ReasonPhrase() const;
       
   102 
       
   103 		/**
       
   104 		* Gets the originator's From-header
       
   105 		* @return a From-header or a 0-pointer if not present. Ownership is
       
   106         *   not transferred.
       
   107 		*/
       
   108 		IMPORT_C const CSIPFromHeader* FromHeader() const;
       
   109 
       
   110 		/**
       
   111 		* Gets the recipient's To-header
       
   112 		* @return a To-header or a 0-pointer if not present. Ownership is
       
   113         *   not transferred.
       
   114 		*/
       
   115 		IMPORT_C const CSIPToHeader* ToHeader() const;
       
   116 
       
   117 		/**
       
   118 		* Gets CSeq-header
       
   119 		* @return a CSeq-header or a 0-pointer if not present. Ownership is
       
   120         *   not transferred.
       
   121 		*/		
       
   122 		IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
       
   123 
       
   124 		/**
       
   125 		* Gets message elements (contains all SIP user headers and content)
       
   126 		* @return message elements
       
   127 		*/
       
   128 		IMPORT_C const CSIPMessageElements& MessageElements() const;
       
   129 
       
   130 		/**
       
   131 		* Gets message elements (contains all SIP user headers and content)
       
   132 		* The response elements can be populated with SIP user headers
       
   133 		* and content using returned reference to the message elements.
       
   134 		* @return message elements
       
   135 		*/
       
   136 		IMPORT_C CSIPMessageElements& MessageElements();
       
   137 
       
   138     public: // New functions, for internal use
       
   139         static CSIPResponseElements* InternalizeL (RReadStream& aReadStream);
       
   140         static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream);
       
   141         void ExternalizeL (RWriteStream& aWriteStream) const;
       
   142 
       
   143     private:
       
   144 	    CSIPResponseElements();
       
   145 	    void ConstructL(TUint aStatusCode, RStringF aReasonPhrase);
       
   146 	    void DoInternalizeL (RReadStream& aReadStream);
       
   147 
       
   148     private: // Data
       
   149 	    TUint iStatusCode;
       
   150 	    RStringF iReasonPhrase;
       
   151         CSIPMessageElements* iMessageElements;
       
   152 	};
       
   153 
       
   154 #endif // end of CSIPRESPONSEELEMENTS_H