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 : siprequestelements.h
16 * Part of : SIP Client
17 * Interface : SDK API, SIP API
24 #ifndef CSIPREQUESTELEMENTS_H
25 #define CSIPREQUESTELEMENTS_H
30 #include <stringpool.h>
33 // FORWARD DECLARATIONS
34 class CSIPMessageElements;
46 * Class provides functions for creation and manipulation of originator's and
47 * recipient's addresses in a SIP request. It also provide functions for
48 * manipulation of SIP method for unknown SIP requests.
51 class CSIPRequestElements : public CBase
53 public: // Constructors and destructor
55 * Two-phased constructor.
56 * If the URI is SIP URI, no SIP URI headers are allowed.
57 * @pre aRemoteURi != 0
58 * @param aRemoteUri Remote target URI that identifies a resource that
59 * the request is addressed to. The ownership is transferred.
61 IMPORT_C static CSIPRequestElements* NewL(CUri8* aRemoteUri);
64 * Two-phased constructor.
65 * If the URI is SIP URI, no SIP URI headers are allowed.
66 * @pre aRemoteURi != 0
67 * @param aRemoteUri Remote target URI that identifies a resource that
68 * the request is addressed to. The ownership is transferred.
70 IMPORT_C static CSIPRequestElements* NewLC(CUri8* aRemoteUri);
75 IMPORT_C ~CSIPRequestElements();
77 public: // New functions
79 * Sets/resets the recipient's To-header
80 * To-header must not contain tag-parameter.
82 * @param aTo a To-header to be set, the ownership is transferred.
84 IMPORT_C void SetToHeaderL(CSIPToHeader* aTo);
87 * Gets the recipient's To-header
88 * @return To-header or a 0-pointer if not present. Ownership is not
91 IMPORT_C const CSIPToHeader* ToHeader() const;
94 * Sets/resets the originator's From-header.
95 * From-header must not contain tag-parameter.
97 * @param aFrom a From-header to be set, the ownership is transferred.
98 * @leave KErrArgument if aFrom == 0
100 IMPORT_C void SetFromHeaderL(CSIPFromHeader* aFrom);
103 * Gets the originator's From-header
104 * @return From-header or a 0-pointer if not present. Ownership is not
107 IMPORT_C const CSIPFromHeader* FromHeader() const;
110 * Gets CSeq-header. Available for only incoming requests.
111 * @return a CSeq-header or a 0-pointer if not present.
112 * Ownership is not transferred.
114 IMPORT_C const CSIPCSeqHeader* CSeqHeader() const;
117 * Sets the remote URI.
118 * If the URI is a SIP URI, no SIP URI headers are allowed.
119 * @pre aRemoteUri != 0
121 * @leave KErrArgument if aRemoteUri==0
123 IMPORT_C void SetRemoteUriL(CUri8* aRemoteUri);
126 * Gets the remote target URI
127 * @return remote target URI
129 IMPORT_C const CUri8& RemoteUri() const;
132 * Sets the SIP request method
133 * @param aMethod a SIP method name.
134 * @leave KErrArgument if method name given is syntactically
137 IMPORT_C void SetMethodL(RStringF aMethod);
140 * Gets the SIP Method for a request
141 * @return a SIP method name or a an empty string if the method
144 IMPORT_C RStringF Method() const;
147 * Gets message elements (contains all SIP user headers and content)
148 * @return message elements
150 IMPORT_C const CSIPMessageElements& MessageElements() const;
153 * Gets message elements (contains all SIP user headers and content)
154 * The response elements can be populated with SIP user headers
155 * and content using returned reference to the message elements.
156 * @return message elements
158 IMPORT_C CSIPMessageElements& MessageElements();
160 public: // New functions, for internal use
161 static CSIPRequestElements* InternalizeL (RReadStream& aReadStream);
162 void ExternalizeL (RWriteStream& aWriteStream) const;
165 CSIPRequestElements();
166 void ConstructL(CUri8* aRemoteUri);
167 void DoInternalizeL(RReadStream& aReadStream);
171 CURIContainer* iRemoteURI;
172 CSIPMessageElements* iMessageElements;
174 private: // For testing purposes
176 friend class CSIPRequestElementsTest;