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 "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".
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>
32 // FORWARD DECLARATIONS
33 class CSIPMessageElements;
44 * Class provides services for creating and manipulating SIP responses
45 * This class is used for creating and manipulating SIP responses including
46 * status code, reason phrase and optional elements such user headers,
47 * content and its type.
51 class CSIPResponseElements : public CBase
53 public: // Constructors and destructor
55 * Two-phased constructor.
56 * @pre aStatusCode > 100 && aStatusCode < 700
57 * @param aStatusCode a known SIP response status code. Cannot be 100.
58 * @param aReasonPhrase a SIP response reason phrase.
60 IMPORT_C static CSIPResponseElements* NewL(TUint aStatusCode,
61 RStringF aReasonPhrase);
64 * Two-phased constructor.
65 * @pre aStatusCode > 100 && aStatusCode < 700
66 * @param aStatusCode a known SIP response status code. Cannot be 100.
67 * @param aReasonPhrase a SIP response reason phrase.
69 IMPORT_C static CSIPResponseElements* NewLC(TUint aStatusCode,
70 RStringF aReasonPhrase);
75 IMPORT_C ~CSIPResponseElements();
77 public: // New functions
79 * Sets a SIP Response extension status code. It is not possible to set
81 * @pre aStatusCode > 100 && aStatusCode < 700
82 * @param aStatusCode extension status code
83 * @leave KErrArgument if aStatusCode < 100 or aStatusCode >= 700
85 IMPORT_C void SetStatusCodeL(TUint aStatusCode);
88 * Gets the SIP Response status code
89 * @return SIP Response status code
91 IMPORT_C TUint StatusCode() const;
94 * Sets a SIP Response Reason Phrase.
95 * @param aReasonPhrase a SIP response reason phrase.
97 IMPORT_C void SetReasonPhraseL(RStringF aReasonPhrase);
100 * Gets a SIP Response Reason Phrase.
101 * @return a SIP response reason phrase or an empty string if
102 * the reason phrase is not defined.
104 IMPORT_C RStringF ReasonPhrase() const;
107 * Gets the originator's From-header
108 * @return a From-header or a 0-pointer if not present. Ownership is
111 IMPORT_C const CSIPFromHeader* FromHeader() const;
114 * Gets the recipient's To-header
115 * @return a To-header or a 0-pointer if not present. Ownership is
118 IMPORT_C const CSIPToHeader* ToHeader() const;
122 * @return a CSeq-header or a 0-pointer if not present. Ownership is
125 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
128 * Gets message elements (contains all SIP user headers and content)
129 * @return message elements
131 IMPORT_C const CSIPMessageElements& MessageElements() const;
134 * Gets message elements (contains all SIP user headers and content)
135 * The response elements can be populated with SIP user headers
136 * and content using returned reference to the message elements.
137 * @return message elements
139 IMPORT_C CSIPMessageElements& MessageElements();
141 public: // New functions, for internal use
142 static CSIPResponseElements* InternalizeL (RReadStream& aReadStream);
143 static CSIPResponseElements* InternalizeLC (RReadStream& aReadStream);
144 void ExternalizeL (RWriteStream& aWriteStream) const;
147 CSIPResponseElements();
148 void ConstructL(TUint aStatusCode, RStringF aReasonPhrase);
149 void DoInternalizeL (RReadStream& aReadStream);
153 RStringF iReasonPhrase;
154 CSIPMessageElements* iMessageElements;
157 #endif // end of CSIPRESPONSEELEMENTS_H