2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipresponseelements.h
16 * Part of : SIP Client
17 * Interface : SDK API, SIP API
24 #ifndef CSIPRESPONSEELEMENTS_H
25 #define CSIPRESPONSEELEMENTS_H
30 #include <stringpool.h>
31 #include "_sipcodecdefs.h"
33 // FORWARD DECLARATIONS
34 class CSIPMessageElements;
45 * Class provides services for creating and manipulating SIP responses
46 * This class is used for creating and manipulating SIP responses including
47 * status code, reason phrase and optional elements such user headers,
48 * content and its type.
52 class CSIPResponseElements : public CBase
54 public: // Constructors and destructor
56 * Two-phased constructor.
57 * @pre aStatusCode > 100 && aStatusCode < 700
58 * @param aStatusCode a known SIP response status code. Cannot be 100.
59 * @param aReasonPhrase a SIP response reason phrase.
61 IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode,
62 RStringF aReasonPhrase);
65 * Two-phased constructor.
66 * @pre aStatusCode > 100 && aStatusCode < 700
67 * @param aStatusCode a known SIP response status code. Cannot be 100.
68 * @param aReasonPhrase a SIP response reason phrase.
70 IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode,
71 RStringF aReasonPhrase);
76 IMPORT_C ~CSIPResponseElements();
78 public: // New functions
80 * Sets a SIP Response extension status code. It is not possible to set
82 * @pre aStatusCode > 100 && aStatusCode < 700
83 * @param aStatusCode extension status code
84 * @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700
86 IMPORT_C void SetStatusCodeL(TUint aStatusCode);
89 * Gets the SIP Response status code
90 * @return SIP Response status code
92 IMPORT_C TUint StatusCode() const;
95 * Sets a SIP Response Reason Phrase.
96 * @param aReasonPhrase a SIP response reason phrase.
98 IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase);
101 * Gets a SIP Response Reason Phrase.
102 * @return a SIP response reason phrase or an empty string if
103 * the reason phrase is not defined.
105 IMPORT_C RStringF ReasonPhrase() const;
108 * Gets the originator's From-header
109 * @return a From-header or a 0-pointer if not present. Ownership is
112 IMPORT_C const CSIPFromHeader* FromHeader() const;
115 * Gets the recipient's To-header
116 * @return a To-header or a 0-pointer if not present. Ownership is
119 IMPORT_C const CSIPToHeader* ToHeader() const;
123 * @return a CSeq-header or a 0-pointer if not present. Ownership is
126 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
129 * Gets message elements (contains all SIP user headers and content)
130 * @return message elements
132 IMPORT_C const CSIPMessageElements& MessageElements() const;
135 * Gets message elements (contains all SIP user headers and content)
136 * The response elements can be populated with SIP user headers
137 * and content using returned reference to the message elements.
138 * @return message elements
140 IMPORT_C CSIPMessageElements& MessageElements();
142 public: // New functions, for internal use
143 static CSIPResponseElements* InternalizeL (RReadStream& aReadStream);
144 static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream);
145 void ExternalizeL (RWriteStream& aWriteStream) const;
148 CSIPResponseElements();
149 void ConstructL(TUint aStatusCode, RStringF aReasonPhrase);
150 void DoInternalizeL (RReadStream& aReadStream);
154 RStringF iReasonPhrase;
155 CSIPMessageElements* iMessageElements;
158 #endif // end of CSIPRESPONSEELEMENTS_H