|
1 /* |
|
2 * Copyright (c) 2003-2009 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: |
|
15 * Name : sipdialogstate.h |
|
16 * Part of : SIPAPI |
|
17 * Interface : |
|
18 * Version : |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 /** |
|
26 @internalComponent |
|
27 */ |
|
28 |
|
29 #ifndef CSIPDIALOGSTATE_H |
|
30 #define CSIPDIALOGSTATE_H |
|
31 |
|
32 // INCLUDES |
|
33 /*#include <e32base.h> |
|
34 #include <stringpool.h>*/ |
|
35 #include "sipdialog.h" |
|
36 #include "_sipcodecdefs.h" |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CSIPMessageElements; |
|
40 class CSIPResponseElements; |
|
41 class CSIPClientTransaction; |
|
42 class CSIPServerTransaction; |
|
43 class CSIPDialogAssocImplementation; |
|
44 class CSIPInviteDialogAssoc; |
|
45 class CSIPNotifyDialogAssoc; |
|
46 class CSIPSubscribeDialogAssoc; |
|
47 class CSIPReferDialogAssoc; |
|
48 class CSIPRefresh; |
|
49 class CConnectionCallback; |
|
50 |
|
51 // CLASS DECLARATION |
|
52 |
|
53 /* |
|
54 * Base class for all dialog states. |
|
55 */ |
|
56 class CDialogState : public CBase |
|
57 { |
|
58 public: // Destructor |
|
59 |
|
60 virtual ~CDialogState(); |
|
61 |
|
62 public: // New functions |
|
63 |
|
64 virtual CSIPDialog::TState State() const = 0; |
|
65 |
|
66 virtual CSIPClientTransaction* |
|
67 SendNonTargetRefreshRequestL(const CSIPDialogImplementation& aDialog, |
|
68 CSIPDialogAssocImplementation& aAssoc, |
|
69 RStringF aMethod, |
|
70 CSIPMessageElements* aElements) const; |
|
71 |
|
72 virtual CSIPClientTransaction* |
|
73 SendInviteL(const CSIPDialogImplementation& aDialog, |
|
74 CSIPInviteDialogAssoc& aAssoc, |
|
75 CSIPMessageElements* aElements) const; |
|
76 |
|
77 virtual CSIPClientTransaction* |
|
78 SendPrackL(CSIPInviteDialogAssoc& aAssoc, |
|
79 CSIPMessageElements* aElements) const; |
|
80 |
|
81 virtual CSIPClientTransaction* |
|
82 SendUpdateL(CSIPInviteDialogAssoc& aAssoc, |
|
83 CSIPMessageElements* aElements) const; |
|
84 |
|
85 virtual void SendAckL(CSIPInviteDialogAssoc& aAssoc, |
|
86 const CSIPClientTransaction& aTransaction, |
|
87 CSIPMessageElements* aElements) const; |
|
88 |
|
89 virtual CSIPClientTransaction* |
|
90 SendByeL(CSIPInviteDialogAssoc& aAssoc, |
|
91 CSIPMessageElements* aElements) const; |
|
92 |
|
93 virtual CSIPClientTransaction* |
|
94 SendNotifyL(CSIPNotifyDialogAssoc& aAssoc, |
|
95 CSIPMessageElements* aElements) const; |
|
96 |
|
97 virtual CSIPClientTransaction* |
|
98 SendReferL(const CSIPDialogImplementation& aDialog, |
|
99 CSIPReferDialogAssoc& aAssoc, |
|
100 CSIPMessageElements* aElements) const; |
|
101 |
|
102 virtual void SendResponseL(CSIPDialogImplementation& aDialog, |
|
103 const CSIPResponseElements& aElements, |
|
104 TUint32 aRequestId, |
|
105 TBool aAffectsDialogState, |
|
106 TBool aTargetRefresh) const; |
|
107 |
|
108 virtual void ConnectionLost(CSIPDialogImplementation& aDialog) const = 0; |
|
109 |
|
110 virtual CSIPClientTransaction* |
|
111 SendSubscribeL(const CSIPDialogImplementation& aDialog, |
|
112 CSIPSubscribeDialogAssoc& aAssoc, |
|
113 CSIPMessageElements* aElements, |
|
114 CSIPRefresh* aRefresh) const; |
|
115 |
|
116 virtual CSIPClientTransaction* |
|
117 UpdateL(const CSIPDialogImplementation& aDialog, |
|
118 CSIPSubscribeDialogAssoc& aAssoc, |
|
119 CSIPMessageElements* aElements) const; |
|
120 |
|
121 virtual CSIPClientTransaction* |
|
122 SendUnsubscribeL(CSIPSubscribeDialogAssoc& aAssoc, |
|
123 CSIPMessageElements* aElements) const; |
|
124 |
|
125 virtual TBool |
|
126 IncomingResponseL(CSIPDialogImplementation& aDialog, |
|
127 CSIPResponseElements* aElements, |
|
128 TUint32 aRequestId, |
|
129 TUint32 aDialogId, |
|
130 CConnectionCallback& aCallback) const; |
|
131 |
|
132 virtual TBool |
|
133 IncomingResponseL(CSIPDialogImplementation& aDialog, |
|
134 CSIPResponseElements* aElements, |
|
135 TUint32 aRequestId, |
|
136 TUint32 aRefreshId, |
|
137 TUint32 aDialogId, |
|
138 CConnectionCallback& aCallback) const; |
|
139 |
|
140 virtual TBool |
|
141 IncomingRequestL(CSIPDialogImplementation& aDialog, |
|
142 CSIPServerTransaction* aTransaction, |
|
143 CConnectionCallback& aCallback) const; |
|
144 |
|
145 virtual TBool ErrorOccured(CSIPDialogImplementation& aDialog, |
|
146 TInt aError, |
|
147 TUint32 aRequestId, |
|
148 CConnectionCallback& aCallback) const; |
|
149 |
|
150 virtual TBool ErrorOccured(CSIPDialogImplementation& aDialog, |
|
151 TInt aError, |
|
152 TUint32 aRefreshId, |
|
153 TUint32 aRequestId, |
|
154 CConnectionCallback& aCallback) const; |
|
155 |
|
156 protected: // New functions |
|
157 |
|
158 TBool HandleErrorOccurred(CSIPDialogImplementation& aDialog, |
|
159 TInt aError, |
|
160 TUint32 aRequestId, |
|
161 CConnectionCallback& aCallback, |
|
162 CDialogState& aTerminated) const; |
|
163 |
|
164 TBool HandleRefreshErrorOccurred(CSIPDialogImplementation& aDialog, |
|
165 TInt aError, |
|
166 TUint32 aRefreshId, |
|
167 CConnectionCallback& aCallback, |
|
168 CDialogState& aTerminated) const; |
|
169 |
|
170 TBool RequestReceivedL(CSIPDialogImplementation& aDialog, |
|
171 CSIPServerTransaction* aTransaction, |
|
172 CConnectionCallback& aCallback) const; |
|
173 |
|
174 void SendResponseWithinDialogL(CSIPDialogImplementation& aDialog, |
|
175 const CSIPResponseElements& aElements, |
|
176 TUint32 aRequestId, |
|
177 TBool aTargetRefresh) const; |
|
178 |
|
179 /** |
|
180 * A response within dialog has been been received. The response might |
|
181 * create a new dialog if INVITE has forked. |
|
182 * |
|
183 * @param aDialog Dialog instance |
|
184 * @param aElements Response elements |
|
185 * @param aRequestId Identifies the transaction |
|
186 * @param aDialogId DialogId |
|
187 * @param aCallback For selecting a callback function and its parameters |
|
188 * @param aEarly Early state of dialog state machine |
|
189 * @param aConfirmed Confirmed state of dialog state machine |
|
190 * @param aTerminated Terminated state of dialog state machine |
|
191 * |
|
192 * @return ETrue if the caller should make a callback function call, |
|
193 * EFalse otherwise |
|
194 */ |
|
195 TBool IncomingResponseWithinDialogL(CSIPDialogImplementation& aDialog, |
|
196 CSIPResponseElements* aElements, |
|
197 TUint32 aRequestId, |
|
198 TUint32 aDialogId, |
|
199 CConnectionCallback& aCallback, |
|
200 const CDialogState& aEarly, |
|
201 const CDialogState& aConfirmed, |
|
202 const CDialogState& aTerminated) const; |
|
203 |
|
204 CSIPInviteDialogAssoc* |
|
205 CheckIfForkingL(CSIPDialogImplementation& aDialog, |
|
206 TUint32 aDialogId, |
|
207 CSIPResponseElements* aElements, |
|
208 CSIPClientTransaction& aTransaction) const; |
|
209 |
|
210 CSIPInviteDialogAssoc* |
|
211 CreateForkedInviteAssocLC(CSIPDialogImplementation& aDialog, |
|
212 CSIPResponseElements& aElements) const; |
|
213 |
|
214 /** |
|
215 * A response to a refreshed request has been received. |
|
216 * |
|
217 * @param aDialog Dialog instance |
|
218 * @param aElements Response elements |
|
219 * @param aRequestId Identifies the transaction |
|
220 * @param aRefreshId Identifies the refresh |
|
221 * @param aCallback For selecting a callback function and its parameters |
|
222 * @param aEarly Early state of dialog state machine |
|
223 * @param aConfirmed Confirmed state of dialog state machine |
|
224 * @param aTerminated Terminated state of dialog state machine |
|
225 * |
|
226 * @return ETrue if the caller should make a callback function call, |
|
227 * EFalse otherwise |
|
228 */ |
|
229 TBool ResponseToRefreshL(CSIPDialogImplementation& aDialog, |
|
230 CSIPResponseElements* aElements, |
|
231 TUint32 aRequestId, |
|
232 TUint32 aRefreshId, |
|
233 CConnectionCallback& aCallback, |
|
234 const CDialogState& aEarly, |
|
235 const CDialogState& aConfirmed, |
|
236 const CDialogState& aTerminated) const; |
|
237 |
|
238 private: // New functions |
|
239 |
|
240 CSIPClientTransaction* InvalidStateL() const; |
|
241 |
|
242 private: // For testing purposes |
|
243 |
|
244 UNIT_TEST(CSIP_Test) |
|
245 }; |
|
246 |
|
247 #endif |