1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/sipresponseelements.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,158 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* 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
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +* Name : sipresponseelements.h
1.19 +* Part of : SIP Client
1.20 +* Interface : SDK API, SIP API
1.21 +* Version : 1.0
1.22 +*
1.23 +*/
1.24 +
1.25 +
1.26 +
1.27 +#ifndef CSIPRESPONSEELEMENTS_H
1.28 +#define CSIPRESPONSEELEMENTS_H
1.29 +
1.30 +// INCLUDES
1.31 +#include <e32base.h>
1.32 +#include <s32strm.h>
1.33 +#include <stringpool.h>
1.34 +#include "_sipcodecdefs.h"
1.35 +
1.36 +// FORWARD DECLARATIONS
1.37 +class CSIPMessageElements;
1.38 +class CSIPFromHeader;
1.39 +class CSIPToHeader;
1.40 +class CSIPCSeqHeader;
1.41 +
1.42 +// CLASS DECLARATION
1.43 +
1.44 +/**
1.45 +* @publishedAll
1.46 +* @released
1.47 +*
1.48 +* Class provides services for creating and manipulating SIP responses
1.49 +* This class is used for creating and manipulating SIP responses including
1.50 +* status code, reason phrase and optional elements such user headers,
1.51 +* content and its type.
1.52 +*
1.53 +* @lib sipclient.lib
1.54 +*/
1.55 +class CSIPResponseElements : public CBase
1.56 + {
1.57 + public: // Constructors and destructor
1.58 + /**
1.59 + * Two-phased constructor.
1.60 + * @pre aStatusCode > 100 && aStatusCode < 700
1.61 + * @param aStatusCode a known SIP response status code. Cannot be 100.
1.62 + * @param aReasonPhrase a SIP response reason phrase.
1.63 + */
1.64 + IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode,
1.65 + RStringF aReasonPhrase);
1.66 +
1.67 + /**
1.68 + * Two-phased constructor.
1.69 + * @pre aStatusCode > 100 && aStatusCode < 700
1.70 + * @param aStatusCode a known SIP response status code. Cannot be 100.
1.71 + * @param aReasonPhrase a SIP response reason phrase.
1.72 + */
1.73 + IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode,
1.74 + RStringF aReasonPhrase);
1.75 +
1.76 + /**
1.77 + * Destructor.
1.78 + */
1.79 + IMPORT_C ~CSIPResponseElements();
1.80 +
1.81 + public: // New functions
1.82 + /**
1.83 + * Sets a SIP Response extension status code. It is not possible to set
1.84 + * value 100.
1.85 + * @pre aStatusCode > 100 && aStatusCode < 700
1.86 + * @param aStatusCode extension status code
1.87 + * @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700
1.88 + */
1.89 + IMPORT_C void SetStatusCodeL(TUint aStatusCode);
1.90 +
1.91 + /**
1.92 + * Gets the SIP Response status code
1.93 + * @return SIP Response status code
1.94 + */
1.95 + IMPORT_C TUint StatusCode() const;
1.96 +
1.97 + /**
1.98 + * Sets a SIP Response Reason Phrase.
1.99 + * @param aReasonPhrase a SIP response reason phrase.
1.100 + */
1.101 + IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase);
1.102 +
1.103 + /**
1.104 + * Gets a SIP Response Reason Phrase.
1.105 + * @return a SIP response reason phrase or an empty string if
1.106 + * the reason phrase is not defined.
1.107 + */
1.108 + IMPORT_C RStringF ReasonPhrase() const;
1.109 +
1.110 + /**
1.111 + * Gets the originator's From-header
1.112 + * @return a From-header or a 0-pointer if not present. Ownership is
1.113 + * not transferred.
1.114 + */
1.115 + IMPORT_C const CSIPFromHeader* FromHeader() const;
1.116 +
1.117 + /**
1.118 + * Gets the recipient's To-header
1.119 + * @return a To-header or a 0-pointer if not present. Ownership is
1.120 + * not transferred.
1.121 + */
1.122 + IMPORT_C const CSIPToHeader* ToHeader() const;
1.123 +
1.124 + /**
1.125 + * Gets CSeq-header
1.126 + * @return a CSeq-header or a 0-pointer if not present. Ownership is
1.127 + * not transferred.
1.128 + */
1.129 + IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
1.130 +
1.131 + /**
1.132 + * Gets message elements (contains all SIP user headers and content)
1.133 + * @return message elements
1.134 + */
1.135 + IMPORT_C const CSIPMessageElements& MessageElements() const;
1.136 +
1.137 + /**
1.138 + * Gets message elements (contains all SIP user headers and content)
1.139 + * The response elements can be populated with SIP user headers
1.140 + * and content using returned reference to the message elements.
1.141 + * @return message elements
1.142 + */
1.143 + IMPORT_C CSIPMessageElements& MessageElements();
1.144 +
1.145 + public: // New functions, for internal use
1.146 + static CSIPResponseElements* InternalizeL (RReadStream& aReadStream);
1.147 + static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream);
1.148 + void ExternalizeL (RWriteStream& aWriteStream) const;
1.149 +
1.150 + private:
1.151 + CSIPResponseElements();
1.152 + void ConstructL(TUint aStatusCode, RStringF aReasonPhrase);
1.153 + void DoInternalizeL (RReadStream& aReadStream);
1.154 +
1.155 + private: // Data
1.156 + TUint iStatusCode;
1.157 + RStringF iReasonPhrase;
1.158 + CSIPMessageElements* iMessageElements;
1.159 + };
1.160 +
1.161 +#endif // end of CSIPRESPONSEELEMENTS_H