williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Name : sipdialog.h
|
williamr@2
|
16 |
* Part of : SIP Client
|
williamr@2
|
17 |
* Interface : SDK API, SIP Client API
|
williamr@2
|
18 |
* Version : 1.0
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#ifndef CSIPDIALOG_H
|
williamr@2
|
26 |
#define CSIPDIALOG_H
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// INCLUDES
|
williamr@2
|
29 |
#include <e32base.h>
|
williamr@2
|
30 |
#include <stringpool.h>
|
williamr@2
|
31 |
|
williamr@2
|
32 |
// FORWARD DECLARATIONS
|
williamr@2
|
33 |
class CSIPConnection;
|
williamr@2
|
34 |
class CSIPConnectionImplementation;
|
williamr@2
|
35 |
class MSIPRegistrationContext;
|
williamr@2
|
36 |
class CSIPDialogAssocBase;
|
williamr@2
|
37 |
class CSIPFromHeader;
|
williamr@2
|
38 |
class CSIPToHeader;
|
williamr@2
|
39 |
class CSIPCallIDHeader;
|
williamr@2
|
40 |
class CUri8;
|
williamr@2
|
41 |
class CSIPDialogImplementation;
|
williamr@2
|
42 |
|
williamr@2
|
43 |
// CLASS DECLARATION
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* @publishedAll
|
williamr@2
|
47 |
* @released
|
williamr@2
|
48 |
*
|
williamr@2
|
49 |
* Class for managing SIP dialogs.
|
williamr@2
|
50 |
* It provides services querying dialog state, obtaining the dialog related
|
williamr@2
|
51 |
* SIP headers and getting all dialog associations.
|
williamr@2
|
52 |
*
|
williamr@2
|
53 |
* The user of the class cannot instantiate this class.
|
williamr@2
|
54 |
* @lib sipclient
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
|
williamr@2
|
57 |
class CSIPDialog: public CBase
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
public:
|
williamr@2
|
60 |
/** Dialog states */
|
williamr@2
|
61 |
enum TState
|
williamr@2
|
62 |
{
|
williamr@2
|
63 |
/** Initiliazed state */
|
williamr@2
|
64 |
EInit,
|
williamr@2
|
65 |
/** Early state */
|
williamr@2
|
66 |
EEarly,
|
williamr@2
|
67 |
/** Confirmed state */
|
williamr@2
|
68 |
EConfirmed,
|
williamr@2
|
69 |
/** Terminated state */
|
williamr@2
|
70 |
ETerminated
|
williamr@2
|
71 |
};
|
williamr@2
|
72 |
|
williamr@2
|
73 |
public: //New functions
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
* Gets dialog state
|
williamr@2
|
76 |
* @return dialog state
|
williamr@2
|
77 |
*/
|
williamr@2
|
78 |
IMPORT_C CSIPDialog::TState State() const;
|
williamr@2
|
79 |
|
williamr@2
|
80 |
/**
|
williamr@2
|
81 |
* Gets all dialog associations.
|
williamr@2
|
82 |
* @return All dialog associations. Ownership of the array or the items
|
williamr@2
|
83 |
* inside it, is not transferred.
|
williamr@2
|
84 |
*/
|
williamr@2
|
85 |
IMPORT_C const RPointerArray<CSIPDialogAssocBase>&
|
williamr@2
|
86 |
SIPDialogAssociations() const;
|
williamr@2
|
87 |
|
williamr@2
|
88 |
/**
|
williamr@2
|
89 |
* Gets used registration context for this dialog
|
williamr@2
|
90 |
* @return associated registration or 0-pointer otherwise.
|
williamr@2
|
91 |
* Ownership is not transferred.
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
IMPORT_C const MSIPRegistrationContext* RegistrationContext() const;
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
* Checks if the dialog association belongs to this dialog
|
williamr@2
|
97 |
* @param aDialogAssoc a dialog association
|
williamr@2
|
98 |
* @return ETrue if belongs, EFalse otherwise
|
williamr@2
|
99 |
*/
|
williamr@2
|
100 |
IMPORT_C TBool
|
williamr@2
|
101 |
IsAssociated(const CSIPDialogAssocBase& aDialogAssoc) const;
|
williamr@2
|
102 |
|
williamr@2
|
103 |
/**
|
williamr@2
|
104 |
* Gets the SIP connection used for this dialog
|
williamr@2
|
105 |
* @return SIP connection used for the dialog, or 0-pointer if the
|
williamr@2
|
106 |
* connection has been deleted. Ownership isn't transferred.
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
IMPORT_C CSIPConnection* Connection();
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/**
|
williamr@2
|
111 |
* Gets the SIP connection used for this dialog.
|
williamr@2
|
112 |
* @return SIP connection used for the dialog, or 0-pointer if the
|
williamr@2
|
113 |
* connection has been deleted. Ownership isn't transferred.
|
williamr@2
|
114 |
*/
|
williamr@2
|
115 |
IMPORT_C const CSIPConnection* Connection() const;
|
williamr@2
|
116 |
|
williamr@2
|
117 |
/**
|
williamr@2
|
118 |
* Gets originator's address
|
williamr@2
|
119 |
* @return originator's address (From-header)
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
IMPORT_C const CSIPFromHeader& FromHeader() const;
|
williamr@2
|
122 |
|
williamr@2
|
123 |
/**
|
williamr@2
|
124 |
* Gets recipient's address
|
williamr@2
|
125 |
* @return recipient's address (To-header)
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
IMPORT_C const CSIPToHeader& ToHeader() const;
|
williamr@2
|
128 |
|
williamr@2
|
129 |
/**
|
williamr@2
|
130 |
* Gets remote-uri used during dialog creation
|
williamr@2
|
131 |
* @return Remote target uri
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
IMPORT_C const CUri8& RemoteURI() const;
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/**
|
williamr@2
|
136 |
* Gets Call-ID of SIP dialog
|
williamr@2
|
137 |
* @pre State()==CSIPDialog::EEarly || State()==CSIPDialog::EConfirmed
|
williamr@2
|
138 |
* @return Call-ID of SIP dialog
|
williamr@2
|
139 |
* @leave KErrSIPInvalidDialogState if dialog doesn't yet have a Call-ID
|
williamr@2
|
140 |
*/
|
williamr@2
|
141 |
IMPORT_C const CSIPCallIDHeader& CallIdL() const;
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Compares this object to another object
|
williamr@2
|
145 |
* @param aDialog CSIPDialog object to compare
|
williamr@2
|
146 |
* @returns ETrue if the objects are equal, otherwise EFalse
|
williamr@2
|
147 |
*/
|
williamr@2
|
148 |
IMPORT_C TBool operator==(const CSIPDialog& aDialog) const;
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
* Sets the dialog to state to CSIPDialog::EInit.
|
williamr@2
|
152 |
* The local dialog identifier data
|
williamr@2
|
153 |
* (Call-ID, CSeq and From-header's tag) will be reused.
|
williamr@2
|
154 |
* After calling this function, the dialog that was already terminated
|
williamr@2
|
155 |
* can be used for sending the dialog initiating request such as
|
williamr@2
|
156 |
* INVITE or SUBSCRIBE reusing the stored Call-ID and From-header's tag
|
williamr@2
|
157 |
* and the stored CSeq incremented by one.
|
williamr@2
|
158 |
* @pre State()==CSIPDialog::ETerminated
|
williamr@2
|
159 |
* @returns KErrNone if succesful and KErrNoMemory if the memory is low.
|
williamr@2
|
160 |
*/
|
williamr@2
|
161 |
IMPORT_C TInt ReuseInitialRequestData();
|
williamr@2
|
162 |
|
williamr@2
|
163 |
public: //Constructors and destructor, for internal use
|
williamr@2
|
164 |
/**
|
williamr@2
|
165 |
* Two-phased constructor.
|
williamr@2
|
166 |
* This constructor should be used if the user has received
|
williamr@2
|
167 |
* SIP request that creates a SIP dialog association.
|
williamr@2
|
168 |
*
|
williamr@2
|
169 |
* @param aConnImplementation Implementation of the used SIP connection
|
williamr@2
|
170 |
* @return New object, ownership is transferred.
|
williamr@2
|
171 |
*/
|
williamr@2
|
172 |
static CSIPDialog*
|
williamr@2
|
173 |
NewL(CSIPConnectionImplementation& aConnImplementation);
|
williamr@2
|
174 |
|
williamr@2
|
175 |
/**
|
williamr@2
|
176 |
* Two-phased constructor
|
williamr@2
|
177 |
* This constructor should be used if the user has received
|
williamr@2
|
178 |
* SIP request that creates a SIP dialog association.
|
williamr@2
|
179 |
*
|
williamr@2
|
180 |
* @param aConnImplementation Implementation of the used SIP connection
|
williamr@2
|
181 |
* @return New object, ownership is transferred.
|
williamr@2
|
182 |
*/
|
williamr@2
|
183 |
static CSIPDialog*
|
williamr@2
|
184 |
NewLC(CSIPConnectionImplementation& aConnImplementation);
|
williamr@2
|
185 |
|
williamr@2
|
186 |
/**
|
williamr@2
|
187 |
* Two-phased constructor
|
williamr@2
|
188 |
* This constructor should be used if the user has received
|
williamr@2
|
189 |
* SIP request that creates a SIP dialog association.
|
williamr@2
|
190 |
*
|
williamr@2
|
191 |
* @param aConnImplementation Implementation of the used SIP connection
|
williamr@2
|
192 |
* @param aContext Registration context whose outbound proxy and other
|
williamr@2
|
193 |
* parameters are to be used.
|
williamr@2
|
194 |
* @return New object, ownership is transferred.
|
williamr@2
|
195 |
*/
|
williamr@2
|
196 |
static CSIPDialog*
|
williamr@2
|
197 |
NewL(CSIPConnectionImplementation& aConnImplementation,
|
williamr@2
|
198 |
const MSIPRegistrationContext& aContext);
|
williamr@2
|
199 |
|
williamr@2
|
200 |
/**
|
williamr@2
|
201 |
* Two-phased constructor
|
williamr@2
|
202 |
* This constructor should be used if the user has received
|
williamr@2
|
203 |
* SIP request that creates a SIP dialog association.
|
williamr@2
|
204 |
*
|
williamr@2
|
205 |
* @param aConnImplementation Implementation of the used SIP connection
|
williamr@2
|
206 |
* @param aContext Registration context whose outbound proxy and other
|
williamr@2
|
207 |
* parameters are to be used.
|
williamr@2
|
208 |
* @return New object, ownership is transferred.
|
williamr@2
|
209 |
*/
|
williamr@2
|
210 |
static CSIPDialog*
|
williamr@2
|
211 |
NewLC(CSIPConnectionImplementation& aConnImplementation,
|
williamr@2
|
212 |
const MSIPRegistrationContext& aContext);
|
williamr@2
|
213 |
|
williamr@2
|
214 |
/**
|
williamr@2
|
215 |
* Destructor
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
~CSIPDialog();
|
williamr@2
|
218 |
|
williamr@2
|
219 |
public: // New functions, for internal use
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/**
|
williamr@2
|
222 |
* Returns the CSIPDialogImplementation.
|
williamr@2
|
223 |
* @return CSIPDialogImplementation
|
williamr@2
|
224 |
*/
|
williamr@2
|
225 |
CSIPDialogImplementation& Implementation();
|
williamr@2
|
226 |
|
williamr@2
|
227 |
private: // Constructors
|
williamr@2
|
228 |
|
williamr@2
|
229 |
CSIPDialog();
|
williamr@2
|
230 |
|
williamr@2
|
231 |
void ConstructL(CSIPConnectionImplementation& aConnImplementation);
|
williamr@2
|
232 |
|
williamr@2
|
233 |
void ConstructL(CSIPConnectionImplementation& aConnImplementation,
|
williamr@2
|
234 |
const MSIPRegistrationContext& aContext);
|
williamr@2
|
235 |
|
williamr@2
|
236 |
private: // Data
|
williamr@2
|
237 |
|
williamr@2
|
238 |
//Implementation instance, CSIPDialog doesn't own it
|
williamr@2
|
239 |
CSIPDialogImplementation* iImplementation;
|
williamr@2
|
240 |
|
williamr@2
|
241 |
private: // For testing purposes
|
williamr@4
|
242 |
#ifdef CPPUNIT_TEST
|
williamr@4
|
243 |
friend class CSIP_Test;
|
williamr@4
|
244 |
friend class CSIPInviteDialogAssoc_Test;
|
williamr@4
|
245 |
friend class CSIPSubscribeDialogAssoc_Test;
|
williamr@4
|
246 |
friend class CSIPReferDialogAssoc_Test;
|
williamr@4
|
247 |
#endif
|
williamr@4
|
248 |
void __DbgTestInvariant() const;
|
williamr@2
|
249 |
|
williamr@2
|
250 |
};
|
williamr@2
|
251 |
|
williamr@2
|
252 |
#endif
|