1 /* |
|
2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CMusAvaSipConObserver is SIP API observer class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MUSAVASIPCONNECTIONOBSERVER_H |
|
21 #define MUSAVASIPCONNECTIONOBSERVER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <sipconnectionobserver.h> |
|
25 #include "musunittesting.h" |
|
26 |
|
27 class CMusAvaSip; |
|
28 class CSIPDialog; |
|
29 class CSIPServerTransaction; |
|
30 class CSIPClientTransaction; |
|
31 class CSIPDialogAssocBase; |
|
32 class CSIPRegistrationBinding; |
|
33 class MMusAvaSipConnectionAdapter; |
|
34 class CMusAvaSipDefaultHandler; |
|
35 |
|
36 /** |
|
37 * CMusAvaSipConnectionObserver implements observer interface of SIP API |
|
38 * |
|
39 * |
|
40 * |
|
41 * @lib musavailabilityplugin.lib |
|
42 * @since S60 v3.2 |
|
43 */ |
|
44 |
|
45 |
|
46 class CMusAvaSipConnectionObserver : public CBase, |
|
47 public MSIPConnectionObserver |
|
48 { |
|
49 |
|
50 public: // constructors and destructor |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * |
|
55 * @since S60 v3.2 |
|
56 * @param aMusAvaSip pointer to CMusAvaSip |
|
57 */ |
|
58 static CMusAvaSipConnectionObserver* NewL(); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CMusAvaSipConnectionObserver(); |
|
64 |
|
65 public: |
|
66 /** |
|
67 * . |
|
68 */ |
|
69 void AddObserverL( MMusAvaSipConnectionAdapter& aAdapter, TInt aIndex ); |
|
70 |
|
71 /** |
|
72 * . |
|
73 */ |
|
74 void RemoveObserver( MMusAvaSipConnectionAdapter& aAdapter ); |
|
75 |
|
76 |
|
77 public: // functions from base classes |
|
78 |
|
79 /** |
|
80 * A SIP request outside a dialog has been received from the network. |
|
81 * |
|
82 * @since S60 v3.2 |
|
83 * @param aTransaction SIP server transaction. The ownership is |
|
84 * transferred. |
|
85 */ |
|
86 void IncomingRequest ( CSIPServerTransaction* aTransaction ); |
|
87 |
|
88 /** |
|
89 * A SIP request within a dialog has been received from the network. |
|
90 * The client must resolve the actual dialog association to which |
|
91 * this request belongs. |
|
92 * |
|
93 * @since S60 v3.2 |
|
94 * @param aTransaction SIP server transaction. The ownership is |
|
95 * transferred. |
|
96 * @param aDialog the dialog that this transaction belongs to. |
|
97 */ |
|
98 void IncomingRequest( CSIPServerTransaction* aTransaction, |
|
99 CSIPDialog& aDialog ); |
|
100 |
|
101 /** |
|
102 * A SIP response received from the network. |
|
103 * |
|
104 * @since S60 v3.2 |
|
105 * @param aTransaction contains response elements. |
|
106 */ |
|
107 void IncomingResponse( CSIPClientTransaction& aTransaction ); |
|
108 |
|
109 /** |
|
110 * A SIP response that is within a dialog association or creates |
|
111 * a dialog association. |
|
112 * |
|
113 * @since S60 v3.2 |
|
114 * @param aTransaction contains response elements. |
|
115 * @param aDialogAssoc a dialog association. |
|
116 */ |
|
117 void IncomingResponse( CSIPClientTransaction& aTransaction, |
|
118 CSIPDialogAssocBase& aDialogAssoc ); |
|
119 |
|
120 /** |
|
121 * Multiple SIP responses have been received to the single INVITE due |
|
122 * to the forking proxy. Note that each response creates a separate |
|
123 * INVITE dialog association. |
|
124 * Multiple responses can arrive until SIP stack completes UAC core |
|
125 * INVITE transaction. |
|
126 * If clients deletes INVITE transaction after first SIP response |
|
127 * other possible responses will be consumed by the implementation. |
|
128 * |
|
129 * @since S60 v3.2 |
|
130 * @param aTransaction contains response elements |
|
131 * @param aDialogAssoc INVITE dialog association; the ownership is |
|
132 * transferred |
|
133 */ |
|
134 void IncomingResponse( CSIPClientTransaction& aTransaction, |
|
135 CSIPInviteDialogAssoc* aDialogAssoc ); |
|
136 /** |
|
137 * A SIP response related a registration binding or an error response |
|
138 * that is related to a refreshed registration binding has been received |
|
139 * from the network. |
|
140 * |
|
141 * @since S60 v3.2 |
|
142 * @param aTransaction contains response elements. |
|
143 * @param aRegistration associated registration binding. |
|
144 */ |
|
145 void IncomingResponse (CSIPClientTransaction& aTransaction, |
|
146 CSIPRegistrationBinding& aRegistration); |
|
147 |
|
148 /** |
|
149 * An asynchronous error has occurred in the stack related to the |
|
150 * request indicated by the given transaction. |
|
151 * |
|
152 * @since S60 v3.2 |
|
153 * @param aError error code |
|
154 * @param aTransaction failed transaction. |
|
155 * @param aSIPConnection a SIP connection |
|
156 */ |
|
157 void ErrorOccured( TInt aError, |
|
158 CSIPTransactionBase& aTransaction ); |
|
159 |
|
160 /** |
|
161 * An asynchronous error has occurred in the stack related |
|
162 * to the request indicated by the given transaction. |
|
163 * |
|
164 * @since S60 v3.2 |
|
165 * @param aError system wide or SIP error code |
|
166 * @param aTransaction the failed transaction |
|
167 * @param aRegistration the failed registration binding |
|
168 */ |
|
169 void ErrorOccured (TInt aError, |
|
170 CSIPClientTransaction& aTransaction, |
|
171 CSIPRegistrationBinding& aRegistration); |
|
172 |
|
173 /** |
|
174 * An asynchronous error has occured related to a request within |
|
175 * an existing dialog. |
|
176 * |
|
177 * @since S60 v3.2 |
|
178 * @param aError error code |
|
179 * @param aTransaction the failed transaction. |
|
180 * @param aDialogAssoc the failed dialog associoation. |
|
181 */ |
|
182 void ErrorOccured( TInt aError, |
|
183 CSIPTransactionBase& aTransaction, |
|
184 CSIPDialogAssocBase& aDialogAssoc ); |
|
185 |
|
186 /** |
|
187 * An asynchronous error has occured related to a refresh |
|
188 * |
|
189 * @since S60 v3.2 |
|
190 * @param aError error code |
|
191 * @param aSIPRefresh original refresh object. |
|
192 */ |
|
193 void ErrorOccured( TInt aError, CSIPRefresh& aSIPRefresh ); |
|
194 |
|
195 /** |
|
196 * An asynchronous error has occured related to a periodical refresh |
|
197 * that relates to a registration. |
|
198 * |
|
199 * @since S60 v3.2 |
|
200 * @param aError system wide or SIP error code; |
|
201 * KErrCouldNotConnect if the refresh has failed |
|
202 * due to the suspended connection. |
|
203 * @param aRegistration associated registration binding |
|
204 */ |
|
205 void ErrorOccured (TInt aError, |
|
206 CSIPRegistrationBinding& aRegistration); |
|
207 |
|
208 /** |
|
209 * An asynchronous error has occured related to a periodical refresh |
|
210 * that belongs to SIP dialog association. |
|
211 * |
|
212 * @since S60 v3.2 |
|
213 * @param aError error code |
|
214 * @param aDialogAssoc SIP dialog association. |
|
215 */ |
|
216 void ErrorOccured( TInt aError, |
|
217 CSIPDialogAssocBase& aDialogAssoc ); |
|
218 |
|
219 |
|
220 /** |
|
221 * SIP stack has completed UAC core INVITE transaction 64*T1 seconds |
|
222 * after the reception of the first 2xx response. No more 2xx responses |
|
223 * can be received to the issued single INVITE. |
|
224 * |
|
225 * If the INVITE transaction does not create a dialog, or the INVITE |
|
226 * transaction encounters an error, this event will not be sent. |
|
227 * |
|
228 * @since S60 v3.2 |
|
229 * @param aTransaction a complete UAC core INVITE transaction |
|
230 */ |
|
231 void InviteCompleted (CSIPClientTransaction& aTransaction); |
|
232 |
|
233 /** |
|
234 * Invite was canceled with the CANCEL |
|
235 * |
|
236 * @since S60 v3.2 |
|
237 * @param aTransaction a canceled INVITE UAS transaction |
|
238 */ |
|
239 void InviteCanceled (CSIPServerTransaction& aTransaction); |
|
240 |
|
241 /** |
|
242 * Connection state has changed. |
|
243 * If connection state has changed to EInactive or EUnavailable, |
|
244 * SIP stack has removed all stand-alone SIP refreshes, registrations |
|
245 * and dialog associations that client requested to refresh. Client may |
|
246 * re-issue refresh requests (stand-alone, registration or dialog |
|
247 * association related) when connection becomes EActive again. |
|
248 * SIP stack also terminates all pending SIP client transactions and no |
|
249 * errors are reported back to the client about the terminated |
|
250 * transactions nor about removed refreshes in order to avoid event |
|
251 * flood. |
|
252 * |
|
253 * @since S60 v3.2 |
|
254 * @param aState indicates the current connection state |
|
255 */ |
|
256 void ConnectionStateChanged (CSIPConnection::TState aState); |
|
257 |
|
258 |
|
259 private: |
|
260 |
|
261 /** |
|
262 * C++ default constructor. |
|
263 * @param aMusAvaSip pointer to CMusAvaSip |
|
264 */ |
|
265 CMusAvaSipConnectionObserver(); |
|
266 |
|
267 /** |
|
268 * By default Symbian 2nd phase constructor is private. |
|
269 */ |
|
270 void ConstructL(); |
|
271 |
|
272 private: // data |
|
273 |
|
274 RPointerArray<MMusAvaSipConnectionAdapter> iObservers; |
|
275 |
|
276 CMusAvaSipDefaultHandler* iDefaultHandler; |
|
277 |
|
278 private: // For testing purposes |
|
279 |
|
280 //MUS_UNITTEST( UT_CMusAvaSip ) |
|
281 MUS_UNITTEST( UT_CMusAvaSipConnectionObserver ) |
|
282 |
|
283 }; |
|
284 |
|
285 #endif // MUSAVASIPCONNECTIONOBSERVER_H |
|