24
|
1 |
// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// PDP SubConnection Provider implementation
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
|
|
24 |
#include "PDPSCPRStates.h"
|
|
25 |
#include "PDPDeftSCPR.h"
|
|
26 |
#include "PDPSCPR.h"
|
|
27 |
#include "PDPSCPRFactory.h"
|
|
28 |
#include <comms-infras/ss_log.h>
|
|
29 |
#include <comms-infras/ss_msgintercept.h>
|
|
30 |
#include <comms-infras/agentscprstates.h>
|
|
31 |
#include <comms-infras/agentscpractivities.h>
|
|
32 |
#include <comms-infras/ss_nodemessages_factory.h>
|
|
33 |
|
|
34 |
#if defined __FLOG_ACTIVE || defined SYMBIAN_TRACE_ENABLE
|
|
35 |
#define KPDPSCprTag KESockSubConnectionTag
|
|
36 |
_LIT8(KPDPSCprSubTag, "pdpscpr");
|
|
37 |
#endif
|
|
38 |
|
|
39 |
using namespace Messages;
|
|
40 |
using namespace MeshMachine;
|
|
41 |
using namespace ESock;
|
|
42 |
using namespace NetStateMachine;
|
|
43 |
using namespace Factories;
|
|
44 |
|
|
45 |
//We reserve space for two preallocated activities that may start concurrently on the SCPR
|
|
46 |
//node: destroy and data client stop.
|
|
47 |
static const TUint KDefaultMaxPreallocatedActivityCount = 2;
|
|
48 |
static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>);
|
|
49 |
static const TUint KPDPSCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize;
|
|
50 |
|
|
51 |
//-=========================================================
|
|
52 |
//
|
|
53 |
// CPDPSubConnectionProvider Activities
|
|
54 |
//
|
|
55 |
//-=========================================================
|
|
56 |
|
|
57 |
namespace PDPSCprProvisionActivity
|
|
58 |
{
|
|
59 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityStoreProvision, provision, TCFDataClient::TProvisionConfig)
|
|
60 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TStoreProvisionAndInitSelf, CoreNetStates::TAwaitingProvision, MeshMachine::TNoTag)
|
|
61 |
NODEACTIVITY_END()
|
|
62 |
}
|
|
63 |
|
|
64 |
namespace PDPSCprStartActivity
|
|
65 |
{
|
|
66 |
DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, PDPScprStart, TCFServiceProvider::TStart, MeshMachine::CNodeRetryActivity::NewL)
|
|
67 |
FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, CoreNetStates::TNoTagOrBearerPresentBlockedByStop)
|
|
68 |
NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TStartSelf, CoreNetStates::TAwaitingDataClientStarted, MeshMachine::TNoTag)
|
|
69 |
LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendStarted)
|
|
70 |
LAST_NODEACTIVITY_ENTRY(CoreNetStates::KBearerPresent, CoreStates::TPanic)
|
|
71 |
NODEACTIVITY_END()
|
|
72 |
}
|
|
73 |
|
|
74 |
namespace PDPSCprDataClientStartActivity
|
|
75 |
{
|
|
76 |
typedef MeshMachine::TAcceptErrorState<CoreNetStates::TAwaitingDataClientStarted> TAwaitingDataClientStartedOrError;
|
|
77 |
|
|
78 |
DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStartDataClient, pdpDataClientStart, TCFDataClient::TStart, PDPSCprStates::CStartActivity::NewL)
|
|
79 |
FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingDataClientStart, MeshMachine::TNoTag)
|
|
80 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TCreateSecondaryOrMbmsPDPCtx, PDPSCprStates::TAwaitingPDPCtxCreated, PDPSCprStates::TNoTagOrError)
|
|
81 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TSetTFT, PDPSCprStates::TAwaitingTFTSet, PDPSCprStates::TNoTagOrError)
|
|
82 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TSetQoS, PDPSCprStates::TAwaitingQoSSet, PDPSCprStates::TNoTagOrError)
|
|
83 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TActivatePDPContext, PDPSCprStates::TAwaitingPDPContextActive, PDPSCprStates::TNoTagOrError)
|
|
84 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TOverrideProvisionAndStartDataClient, TAwaitingDataClientStartedOrError, MeshMachine::TNoTagOrErrorTag)
|
|
85 |
//This call below is somewhat obscure, but must be performed for the final activation of a pdp context.
|
|
86 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TGetNegotiatedQoS, PDPSCprStates::TAwaitingNegotiatedQoSRetrieved, PDPSCprStates::TNoTagOrError)
|
|
87 |
LAST_NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TRaiseParamsGrantedAndSendDataClientStarted)
|
|
88 |
|
|
89 |
// Cleanup if error occurred
|
|
90 |
THROUGH_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TDoNothing, CoreNetStates::TNoTagOrNoDataClientsToStop)
|
|
91 |
NODEACTIVITY_ENTRY(KNoTag, SCprStates::TStopYourFlows, CoreNetStates::TAwaitingDataClientStopped, MeshMachine::TTag<CoreNetStates::KNoDataClientsToStop>)
|
|
92 |
THROUGH_NODEACTIVITY_ENTRY(CoreNetStates::KNoDataClientsToStop, MeshMachine::TDoNothing, PDPSCprStates::TNoTagOrProviderStopped)
|
|
93 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TDestroyPDPContext, PDPSCprStates::TAwaitingPDPContextDestroyed, MeshMachine::TTag<CoreNetStates::KProviderStopped>)
|
|
94 |
THROUGH_NODEACTIVITY_ENTRY(CoreNetStates::KProviderStopped, PDPSCprStates::TCleanupFSMAndDataClients, MeshMachine::TTag<CoreNetStates::KProviderStopped>)
|
|
95 |
LAST_NODEACTIVITY_ENTRY(CoreNetStates::KProviderStopped, MeshMachine::TRaiseActivityError)
|
|
96 |
NODEACTIVITY_END()
|
|
97 |
}
|
|
98 |
|
|
99 |
namespace PDPSCprStopActivity
|
|
100 |
{
|
|
101 |
DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStopDataClient, Stop, TCFDataClient::TStop, MeshMachine::CNodeRetryActivity::NewL)
|
|
102 |
FIRST_NODEACTIVITY_ENTRY(PDPSCprStates::TAwaitingDataClientStopOrCancel, MeshMachine::TNoTag)
|
|
103 |
THROUGH_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, PRDataClientStopActivity::TNoTagOrProviderStoppedBlockedByStart)
|
|
104 |
|
|
105 |
// stopping
|
|
106 |
NODEACTIVITY_ENTRY(KNoTag, SCprStates::TStopYourFlows, CoreNetStates::TAwaitingDataClientStopped, MeshMachine::TTag<CoreNetStates::KProviderStopped>)
|
|
107 |
THROUGH_NODEACTIVITY_ENTRY(CoreNetStates::KProviderStopped, MeshMachine::TDoNothing, PDPSCprStates::TNoTagOrProviderStopped)
|
|
108 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TDestroyPDPContext, PDPSCprStates::TAwaitingPDPContextDestroyed, MeshMachine::TTag<CoreNetStates::KProviderStopped>)
|
|
109 |
THROUGH_NODEACTIVITY_ENTRY(CoreNetStates::KProviderStopped, PDPSCprStates::TCleanupFSMAndDataClients, MeshMachine::TTag<CoreNetStates::KProviderStopped>)
|
|
110 |
LAST_NODEACTIVITY_ENTRY(CoreNetStates::KProviderStopped, PDPSCprStates::TSendDataClientStopped)
|
|
111 |
NODEACTIVITY_END()
|
|
112 |
}
|
|
113 |
|
|
114 |
namespace PDPSCprGoneDownActivity
|
|
115 |
{
|
|
116 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityGoneDown, goneDown, TPDPMessages::TPDPFSMMessage)
|
|
117 |
FIRST_NODEACTIVITY_ENTRY(PDPSCprStates::TAwaitingPDPContextGoneDown, MeshMachine::TActiveOrNoTag<ECFActivityStartDataClient>)
|
|
118 |
THROUGH_NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TSendGoneDown, CoreNetStates::TNoTagOrNoDataClientsToStop)
|
|
119 |
NODEACTIVITY_ENTRY(KNoTag, SCprStates::TStopYourFlows, CoreNetStates::TAwaitingDataClientStopped, MeshMachine::TTag<CoreNetStates::KNoDataClientsToStop>)
|
|
120 |
|
|
121 |
LAST_NODEACTIVITY_ENTRY(KActiveTag, CoreNetStates::TCancelDataClientStart) //MZTODO: This triple should wait for TError sent as a response to TCancel
|
|
122 |
LAST_NODEACTIVITY_ENTRY(CoreNetStates::KNoDataClientsToStop, MeshMachine::TClearError)
|
|
123 |
NODEACTIVITY_END()
|
|
124 |
}
|
|
125 |
|
|
126 |
namespace PDPSCprSetParameters
|
|
127 |
{
|
|
128 |
#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
|
|
129 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, paramRequest, TCFScpr::TSetParamsRequest)
|
|
130 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TStoreAndRespondWithCurrentParams, PRStates::TAwaitingParamRequest, MeshMachine::TNoTag)
|
|
131 |
#else
|
|
132 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, paramRequest, TCFScpr::TParamsRequest)
|
|
133 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TStoreParamsAndRespond, SCprStates::TAwaitingParamRequest, MeshMachine::TNoTag)
|
|
134 |
#endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
|
|
135 |
NODEACTIVITY_END()
|
|
136 |
}
|
|
137 |
|
|
138 |
namespace PDPSCprApply
|
|
139 |
{
|
|
140 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityApplyChanges, pdpApplyReq, TCFScpr::TApplyRequest)
|
|
141 |
#ifdef SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
|
|
142 |
FIRST_NODEACTIVITY_ENTRY(PRStates::TAwaitingApplyRequest, MeshMachine::TNoTag)
|
|
143 |
#else
|
|
144 |
FIRST_NODEACTIVITY_ENTRY(SCprStates::TAwaitingApplyRequest, MeshMachine::TNoTag)
|
|
145 |
#endif // SYMBIAN_ADAPTIVE_TCP_RECEIVE_WINDOW
|
|
146 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TSetTFT, PDPSCprStates::TAwaitingTFTSet, PDPSCprStates::TNoTagOrError)
|
|
147 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TSetQoS, PDPSCprStates::TAwaitingQoSSet, PDPSCprStates::TNoTagOrError)
|
|
148 |
NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TModifyActivePDPContext, PDPSCprStates::TAwaitingActivePDPContextModified, PDPSCprStates::TNoTagOrError)
|
|
149 |
LAST_NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TRaiseParamsGrantedAndSendApplyResponse)
|
|
150 |
LAST_NODEACTIVITY_ENTRY(KErrorTag, PDPSCprStates::TRaiseParamsRejectedL)
|
|
151 |
NODEACTIVITY_END()
|
|
152 |
}
|
|
153 |
|
|
154 |
namespace PDPSCprParamsChanged
|
|
155 |
{
|
|
156 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, paramsChanged, TPDPMessages::TPDPFSMMessage)
|
|
157 |
FIRST_NODEACTIVITY_ENTRY(PDPSCprStates::TAwaitingParamsChanged, PDPSCprStates::TNoTagOrError)
|
|
158 |
LAST_NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TRaiseParamsChanged)
|
|
159 |
LAST_NODEACTIVITY_ENTRY(KErrorTag, PDPSCprStates::TRaiseParamsRejectedL)
|
|
160 |
NODEACTIVITY_END()
|
|
161 |
}
|
|
162 |
|
|
163 |
namespace PDPSCprContextBlockedUnblockedActivity
|
|
164 |
{
|
|
165 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityParamRequest, ctxBlockedUnblocked, TPDPMessages::TPDPFSMMessage)
|
|
166 |
FIRST_NODEACTIVITY_ENTRY(PDPSCprStates::TAwaitingContextBlockedOrUnblocked, MeshMachine::TNoTag)
|
|
167 |
THROUGH_NODEACTIVITY_ENTRY(KNoTag, PDPSCprStates::TForwardContextBlockedOrUnblockedToDC, PDPSCprStates::TBlockedOrUnblocked)
|
|
168 |
LAST_NODEACTIVITY_ENTRY(PDPSCprStates::KBlocked, PDPSCprStates::TSendDataTransferTemporarilyBlocked)
|
|
169 |
/**
|
|
170 |
This needs to send DataTransferUnblocked progress, but this needs to be discussed with people in finland
|
|
171 |
when they return. In old world, KLinkLayerOpen was sent in this case, but KLinkLayerOpen has changed and is misused for
|
|
172 |
this purpose. Should be a new, functionallity specific progress .
|
|
173 |
*/
|
|
174 |
LAST_NODEACTIVITY_ENTRY(PDPSCprStates::KUnblocked, PDPSCprStates::TSendDataTransferUnblocked)
|
|
175 |
NODEACTIVITY_END()
|
|
176 |
}
|
|
177 |
|
|
178 |
namespace PDPSCprStateChangeActivity
|
|
179 |
{
|
|
180 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityForwardStateChange, forwardStateChange, TCFMessage::TStateChange)
|
|
181 |
//Bin all the progresses received, PDP.SCPR will generate its own ones.
|
|
182 |
NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, MeshMachine::TAwaitingMessageState<TCFMessage::TStateChange>, MeshMachine::TNoTag)
|
|
183 |
NODEACTIVITY_END()
|
|
184 |
}
|
|
185 |
|
|
186 |
namespace PDPSCprAuthenticationActivity
|
|
187 |
{
|
|
188 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityAuthentication, PDPSCprAuthentication, TLinkMessage::TAuthenticate)
|
|
189 |
NODEACTIVITY_ENTRY(KNoTag, AgentSCprStates::TSendAuthenticateComplete, AgentSCprStates::TAwaitingAuthenticate, MeshMachine::TNoTag)
|
|
190 |
NODEACTIVITY_END()
|
|
191 |
}
|
|
192 |
|
|
193 |
namespace PDPSCprActivities
|
|
194 |
{
|
|
195 |
DEFINE_ACTIVITY_MAP(activityMap)
|
|
196 |
ACTIVITY_MAP_ENTRY(PDPSCprProvisionActivity, provision)
|
|
197 |
ACTIVITY_MAP_ENTRY(PDPSCprStartActivity, PDPScprStart)
|
|
198 |
ACTIVITY_MAP_ENTRY(PDPSCprDataClientStartActivity, pdpDataClientStart)
|
|
199 |
ACTIVITY_MAP_ENTRY(PDPSCprSetParameters, paramRequest)
|
|
200 |
ACTIVITY_MAP_ENTRY(PDPSCprParamsChanged, paramsChanged)
|
|
201 |
ACTIVITY_MAP_ENTRY(PDPSCprContextBlockedUnblockedActivity, ctxBlockedUnblocked)
|
|
202 |
ACTIVITY_MAP_ENTRY(PDPSCprApply, pdpApplyReq)
|
|
203 |
ACTIVITY_MAP_ENTRY(PDPSCprStopActivity, Stop)
|
|
204 |
ACTIVITY_MAP_ENTRY(PDPSCprGoneDownActivity, goneDown)
|
|
205 |
ACTIVITY_MAP_ENTRY(PDPSCprStateChangeActivity, forwardStateChange)
|
|
206 |
ACTIVITY_MAP_ENTRY(PDPSCprAuthenticationActivity, PDPSCprAuthentication)
|
|
207 |
ACTIVITY_MAP_END_BASE(SCprActivities, coreSCprActivities)
|
|
208 |
}
|
|
209 |
|
|
210 |
//-=========================================================
|
|
211 |
//
|
|
212 |
// CPDPSubConnectionProvider methods
|
|
213 |
//
|
|
214 |
//-=========================================================
|
|
215 |
CPDPSubConnectionProvider* CPDPSubConnectionProvider::NewL(CPDPSubConnectionProviderFactory& aFactory)
|
|
216 |
/**
|
|
217 |
Construct a new PDP SubConnection Provider Object
|
|
218 |
|
|
219 |
@params aFactory factory that create this object
|
|
220 |
@param aConnProvider Connection Provider associated with this object
|
|
221 |
*/
|
|
222 |
{
|
|
223 |
CPDPSubConnectionProvider* ptr = new (ELeave) CPDPSubConnectionProvider(aFactory);
|
|
224 |
CleanupStack::PushL(ptr);
|
|
225 |
ptr->ConstructL();
|
|
226 |
CleanupStack::Pop();
|
|
227 |
return ptr;
|
|
228 |
}
|
|
229 |
|
|
230 |
|
|
231 |
CPDPSubConnectionProvider::~CPDPSubConnectionProvider()
|
|
232 |
{
|
|
233 |
LOG_NODE_DESTROY(KPDPSCprSubTag, CPDPSubConnectionProvider)
|
|
234 |
__FLOG_CLOSE;
|
|
235 |
if (iPdpFsmInterface)
|
|
236 |
{
|
|
237 |
iPdpFsmInterface->Close();
|
|
238 |
}
|
|
239 |
}
|
|
240 |
|
|
241 |
|
|
242 |
CPDPSubConnectionProvider::CPDPSubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory)
|
|
243 |
:CCoreSubConnectionProvider(aFactory, PDPSCprActivities::activityMap::Self()),
|
|
244 |
iPDPFsmContextId(EInvalidContextId),
|
|
245 |
iPdpFsmInterface(NULL),
|
|
246 |
iActivityAwaitingResponse(KActivityNull),
|
|
247 |
iProvisionFailure(KErrCorrupt)
|
|
248 |
{
|
|
249 |
LOG_NODE_CREATE1(KPDPSCprSubTag, CPDPSubConnectionProvider, " [factory=%08x]", &aFactory)
|
|
250 |
__FLOG_OPEN(KCFNodeTag, KPDPSCprSubTag);
|
|
251 |
}
|
|
252 |
|
|
253 |
|
|
254 |
CPDPSubConnectionProvider::CPDPSubConnectionProvider(ESock::CSubConnectionProviderFactoryBase& aFactory,
|
|
255 |
const MeshMachine::TNodeActivityMap& aActivityMap)
|
|
256 |
:CCoreSubConnectionProvider(aFactory, aActivityMap),
|
|
257 |
iPDPFsmContextId(EInvalidContextId),
|
|
258 |
iPdpFsmInterface(NULL),
|
|
259 |
iActivityAwaitingResponse(KActivityNull),
|
|
260 |
iParamsRelease(MPDPParamMapper::KParameterRelInvalid)
|
|
261 |
{
|
|
262 |
}
|
|
263 |
|
|
264 |
void CPDPSubConnectionProvider::ConstructL()
|
|
265 |
/**
|
|
266 |
IP SubConnection Provider Second Phase Constructor
|
|
267 |
*/
|
|
268 |
{
|
|
269 |
CCoreSubConnectionProvider::ConstructL(KPDPSCPRPreallocatedActivityBufferSize);
|
|
270 |
}
|
|
271 |
|
|
272 |
void CPDPSubConnectionProvider::Received(TNodeContextBase& aContext)
|
|
273 |
{
|
|
274 |
Messages::TNodeSignal::TMessageId noPeerIds[] = {
|
|
275 |
TCFFactory::TPeerFoundOrCreated::Id(),
|
|
276 |
TCFPeer::TJoinRequest::Id(),
|
|
277 |
TCFMessage::TStateChange::Id(),
|
|
278 |
Messages::TNodeSignal::TNullMessageId::Id()
|
|
279 |
};
|
|
280 |
MeshMachine::AMMNodeBase::Received(noPeerIds, aContext);
|
|
281 |
MeshMachine::AMMNodeBase::PostReceived(aContext);
|
|
282 |
}
|
|
283 |
|
|
284 |
void CPDPSubConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
|
|
285 |
{
|
|
286 |
ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient);
|
|
287 |
|
|
288 |
PDPSCprStates::TContext ctx(*this, aMessage, aSender, aRecipient);
|
|
289 |
CPDPSubConnectionProvider::Received(ctx);
|
|
290 |
User::LeaveIfError(ctx.iReturn);
|
|
291 |
}
|
|
292 |
|
|
293 |
void CPDPSubConnectionProvider::Event(TInt aEvent, TInt aParam)
|
|
294 |
{
|
|
295 |
TPDPMessages::TPDPFSMMessage msg(aEvent, aParam);
|
|
296 |
|
|
297 |
RClientInterface::OpenPostMessageClose(TNodeCtxId(iActivityAwaitingResponse, Id()), Id(), msg);
|
|
298 |
iActivityAwaitingResponse = KActivityNull;
|
|
299 |
}
|
|
300 |
|
|
301 |
void CPDPSubConnectionProvider::LinkUp()
|
|
302 |
{
|
|
303 |
if (iLinkUps++ == 0)
|
|
304 |
{
|
|
305 |
iDefaultSCPR->LinkUp();
|
|
306 |
}
|
|
307 |
}
|
|
308 |
|
|
309 |
void CPDPSubConnectionProvider::LinkDown(TInt aCause)
|
|
310 |
{
|
|
311 |
if (--iLinkUps == 0)
|
|
312 |
{
|
|
313 |
iDefaultSCPR->LinkDown(aCause);
|
|
314 |
}
|
|
315 |
}
|
|
316 |
|
|
317 |
CSubConQosR99ParamSet* CPDPSubConnectionProvider::GrantedQoS()
|
|
318 |
{
|
|
319 |
if(static_cast<CSubConnectionProviderBase*>(this)->GetParameterBundle().IsNull())
|
|
320 |
{
|
|
321 |
return NULL;
|
|
322 |
}
|
|
323 |
RParameterFamily qosFamily=static_cast<CSubConnectionProviderBase*>(this)->GetParameterBundle().FindFamily(KSubConQoSFamily);
|
|
324 |
if (qosFamily.IsNull())
|
|
325 |
{
|
|
326 |
return NULL;
|
|
327 |
}
|
|
328 |
CSubConQosR99ParamSet* qosParams = static_cast<CSubConQosR99ParamSet*>(qosFamily.FindParameterSet(
|
|
329 |
STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR99ParamsType), RParameterFamily::EGranted));
|
|
330 |
if (!qosParams)
|
|
331 |
{
|
|
332 |
qosParams = static_cast<CSubConQosR99ParamSet*>(qosFamily.FindParameterSet(
|
|
333 |
STypeId::CreateSTypeId(KSubCon3GPPExtParamsFactoryUid,KSubConQosR5ParamsType), RParameterFamily::EGranted));
|
|
334 |
}
|
|
335 |
ASSERT(qosParams);
|
|
336 |
return qosParams;
|
|
337 |
}
|
|
338 |
|
|
339 |
TInt CPDPSubConnectionProvider::QoSRank()
|
|
340 |
/**
|
|
341 |
This method calculates the qos ranking as specified in 3GPP TS 23.107 Annex C.
|
|
342 |
Magic number usage is deemed justified based on the content of 3GPP TS 23.107.
|
|
343 |
*/
|
|
344 |
{
|
|
345 |
CSubConQosR99ParamSet* qosParams = GrantedQoS();
|
|
346 |
ASSERT(qosParams);
|
|
347 |
|
|
348 |
switch (qosParams->GetTrafficClass())
|
|
349 |
{
|
|
350 |
case RPacketQoS::ETrafficClassConversational:
|
|
351 |
return 2;
|
|
352 |
case RPacketQoS::ETrafficClassStreaming:
|
|
353 |
return 3;
|
|
354 |
case RPacketQoS::ETrafficClassInteractive:
|
|
355 |
{
|
|
356 |
switch (qosParams->GetTrafficHandlingPriority())
|
|
357 |
{
|
|
358 |
case RPacketQoS::ETrafficPriority1:
|
|
359 |
return 1;
|
|
360 |
case RPacketQoS::ETrafficPriority2:
|
|
361 |
return 4;
|
|
362 |
case RPacketQoS::ETrafficPriority3:
|
|
363 |
return 5;
|
|
364 |
default:
|
|
365 |
;
|
|
366 |
}
|
|
367 |
break;
|
|
368 |
}
|
|
369 |
case RPacketQoS::ETrafficClassBackground:
|
|
370 |
return 6;
|
|
371 |
default:
|
|
372 |
;
|
|
373 |
}
|
|
374 |
return 7;
|
|
375 |
}
|
|
376 |
|
|
377 |
|
|
378 |
MFactoryQuery::TMatchResult THighestQoSQuery::Match(TFactoryObjectInfo& aSubConnectionInfo)
|
|
379 |
{
|
|
380 |
CPDPSubConnectionProvider* sc = static_cast<CPDPSubConnectionProvider*>(aSubConnectionInfo.iInfo.iFactoryObject);
|
|
381 |
ASSERT(sc && sc->ControlProvider());
|
|
382 |
if (sc->ControlProvider()->RecipientId() == iCtrlProvider &&
|
|
383 |
sc->iPDPFsmContextId != CPDPSubConnectionProvider::EInvalidContextId)
|
|
384 |
{
|
|
385 |
if (NULL == iHighestQoSProvider)
|
|
386 |
{
|
|
387 |
iHighestQoSProvider = sc;
|
|
388 |
}
|
|
389 |
else if (sc->QoSRank() > iHighestQoSProvider->QoSRank())
|
|
390 |
{
|
|
391 |
iHighestQoSProvider = sc;
|
|
392 |
}
|
|
393 |
}
|
|
394 |
return MFactoryQuery::EContinue;
|
|
395 |
}
|
|
396 |
|
|
397 |
TTFTInfo CPDPSubConnectionProvider::GetTftInfoL(CSubConIPAddressInfoParamSet* aParamSet)
|
|
398 |
{
|
|
399 |
/** TODO: What to do if there will be second request before ggsn responce back and first one will go to the granted list
|
|
400 |
Assigning of id's is not correct in that case*/
|
|
401 |
|
|
402 |
TTFTInfo tft;
|
|
403 |
RPacketContext::TPacketFilterV2 pf;
|
|
404 |
|
|
405 |
TUint aParamSetNum = aParamSet->GetParamNum();
|
|
406 |
/** TODO: It should be only one in the queue, so remove the loop */
|
|
407 |
for (TUint i=0; i<aParamSetNum; ++i)
|
|
408 |
{
|
|
409 |
// TUint8* pfAddr(pf.iSrcAddr);
|
|
410 |
|
|
411 |
CSubConIPAddressInfoParamSet::TSubConIPAddressInfo paramInfo(aParamSet->GetParamInfoL(i));
|
|
412 |
|
|
413 |
TInetAddr addr(paramInfo.iCliDstAddr);
|
|
414 |
TUint32 ipv4Addr = addr.Address();
|
|
415 |
|
|
416 |
if(ipv4Addr)
|
|
417 |
{
|
|
418 |
addr.ConvertToV4Mapped();
|
|
419 |
}
|
|
420 |
|
|
421 |
TIp6Addr ipv6 = addr.Ip6Address();
|
|
422 |
Mem::Copy(&pf.iSrcAddr,&ipv6,RPacketContext::KIPAddressSize);
|
|
423 |
|
|
424 |
pf.iId = FindPacketFilterIdL(paramInfo);
|
|
425 |
Mem::Fill(pf.iSrcAddrSubnetMask, sizeof(pf.iSrcAddrSubnetMask), 0xFF);
|
|
426 |
pf.iSrcPortMin = pf.iSrcPortMax = paramInfo.iCliDstAddr.Port();
|
|
427 |
pf.iDestPortMin = pf.iDestPortMax = paramInfo.iCliSrcAddr.Port();
|
|
428 |
pf.iProtocolNumberOrNextHeader = paramInfo.iProtocolId;
|
|
429 |
|
|
430 |
tft.AddPacketFilter(pf);
|
|
431 |
}
|
|
432 |
|
|
433 |
return tft;
|
|
434 |
}
|
|
435 |
|
|
436 |
TTFTOperationCode CPDPSubConnectionProvider::GetOperationCodeL(CSubConIPAddressInfoParamSet* aParamSet)
|
|
437 |
{
|
|
438 |
TTFTOperationCode result(0);
|
|
439 |
TInt count = aParamSet->GetParamNum();
|
|
440 |
if(count > 0)
|
|
441 |
{
|
|
442 |
CSubConIPAddressInfoParamSet::TSubConIPAddressInfo paramInfo(aParamSet->GetParamInfoL(0));
|
|
443 |
switch(paramInfo.iState)
|
|
444 |
{
|
|
445 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::EAdd:
|
|
446 |
result = KAddFilters;
|
|
447 |
break;
|
|
448 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::ERemove:
|
|
449 |
result = KRemoveFilters;
|
|
450 |
break;
|
|
451 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::ENone:
|
|
452 |
if(aParamSet->GetOperationCode() == CSubConIPAddressInfoParamSet::EDelete)
|
|
453 |
{
|
|
454 |
result = KDeleteTFT;
|
|
455 |
}
|
|
456 |
break;
|
|
457 |
default: ;
|
|
458 |
/** TODO: What to do with an error */
|
|
459 |
}
|
|
460 |
}
|
|
461 |
else
|
|
462 |
{
|
|
463 |
/** TODO: Panic? */
|
|
464 |
}
|
|
465 |
|
|
466 |
return result;
|
|
467 |
}
|
|
468 |
|
|
469 |
TUint CPDPSubConnectionProvider::FindPacketFilterIdL(CSubConIPAddressInfoParamSet::TSubConIPAddressInfo aParamInfo)
|
|
470 |
{
|
|
471 |
TUint id = 0;
|
|
472 |
|
|
473 |
switch(aParamInfo.iState)
|
|
474 |
{
|
|
475 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::EAdd :
|
|
476 |
{
|
|
477 |
TUint i = 0;
|
|
478 |
TUint mask = 1;
|
|
479 |
|
|
480 |
// search bitwise for an empty slot
|
|
481 |
while(!(mask & iPacketFilterMaskId) && i<8)
|
|
482 |
{
|
|
483 |
mask <<= 1;
|
|
484 |
++i;
|
|
485 |
}
|
|
486 |
|
|
487 |
// if not found assigne the first slot
|
|
488 |
id = (i>=8) ? 1 : i;
|
|
489 |
}
|
|
490 |
break;
|
|
491 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::ERemove :
|
|
492 |
id = FindIdOfMatchingParamSetL(aParamInfo);
|
|
493 |
break;
|
|
494 |
case CSubConIPAddressInfoParamSet::TSubConIPAddressInfo::ENone :
|
|
495 |
break;
|
|
496 |
default: ;
|
|
497 |
/** TODO: What to do with an error */
|
|
498 |
}
|
|
499 |
|
|
500 |
// increase by one since id is starting from 1
|
|
501 |
return id;
|
|
502 |
}
|
|
503 |
|
|
504 |
TUint CPDPSubConnectionProvider::FindIdOfMatchingParamSetL(CSubConIPAddressInfoParamSet::TSubConIPAddressInfo aParamInfo)
|
|
505 |
{
|
|
506 |
// check the list of the granted params for an index
|
|
507 |
if(GetParameterBundle().IsNull())
|
|
508 |
{
|
|
509 |
return 0;
|
|
510 |
}
|
|
511 |
RParameterFamily ipAddressInfoFamily=GetParameterBundle().FindFamily(KSubConIPAddressInfoFamily);
|
|
512 |
if( ipAddressInfoFamily.IsNull() )
|
|
513 |
{
|
|
514 |
return 0;
|
|
515 |
}
|
|
516 |
|
|
517 |
CSubConIPAddressInfoParamSet* ipAddressInfoSet =
|
|
518 |
static_cast<CSubConIPAddressInfoParamSet*>(
|
|
519 |
ipAddressInfoFamily.FindParameterSet(
|
|
520 |
STypeId::CreateSTypeId(CSubConIPAddressInfoParamSet::EUid,CSubConIPAddressInfoParamSet::ETypeId),
|
|
521 |
RParameterFamily::EGranted));
|
|
522 |
if( ipAddressInfoSet == NULL )
|
|
523 |
{
|
|
524 |
return 0;
|
|
525 |
}
|
|
526 |
TUint count = ipAddressInfoSet->GetParamNum();
|
|
527 |
|
|
528 |
TBool found(EFalse);
|
|
529 |
TUint i=0;
|
|
530 |
|
|
531 |
for(i=0; i<count && !found; ++i)
|
|
532 |
{
|
|
533 |
CSubConIPAddressInfoParamSet::TSubConIPAddressInfo paramInfo(ipAddressInfoSet->GetParamInfoL(i));
|
|
534 |
|
|
535 |
found = paramInfo.Compare(aParamInfo);
|
|
536 |
}
|
|
537 |
// use the index against corresponding array of id's
|
|
538 |
return found ? iPacketFilterId[i] : 0;
|
|
539 |
}
|
|
540 |
|
|
541 |
void CPDPSubConnectionProvider::NewPacketFilterAddedL(CSubConIPAddressInfoParamSet::TSubConIPAddressInfo aParamInfo, TUint aId)
|
|
542 |
{
|
|
543 |
RParameterFamily ipAddressInfoFamily = GetParameterBundle().FindFamily(KSubConIPAddressInfoFamily);
|
|
544 |
if ( ! ipAddressInfoFamily.IsNull())
|
|
545 |
{
|
|
546 |
CSubConIPAddressInfoParamSet* grantedIPAddressInfo = CSubConIPAddressInfoParamSet::NewL(ipAddressInfoFamily, RParameterFamily::EGranted);
|
|
547 |
|
|
548 |
if(grantedIPAddressInfo)
|
|
549 |
{
|
|
550 |
grantedIPAddressInfo->AddParamInfo(aParamInfo);
|
|
551 |
|
|
552 |
iPacketFilterId.Append(aId);
|
|
553 |
iPacketFilterMaskId |= 1 << aId;
|
|
554 |
}
|
|
555 |
else
|
|
556 |
{
|
|
557 |
User::Leave(KErrNotFound);
|
|
558 |
}
|
|
559 |
}
|
|
560 |
}
|
|
561 |
|
|
562 |
void CPDPSubConnectionProvider::PacketFilterRemovedL(TUint aId)
|
|
563 |
{
|
|
564 |
RParameterFamily ipAddressInfoFamily = GetParameterBundle().FindFamily(KSubConIPAddressInfoFamily);
|
|
565 |
|
|
566 |
if ( ! ipAddressInfoFamily.IsNull())
|
|
567 |
{
|
|
568 |
// find an index from given id value
|
|
569 |
//TUint count = iPacketFilterId.Count();
|
|
570 |
TInt index = iPacketFilterId.Find(aId);
|
|
571 |
|
|
572 |
//for (index = 0; (index < count) && (iPacketFilterId[index] != aId); ++index){}
|
|
573 |
|
|
574 |
if(index >= 0)
|
|
575 |
{
|
|
576 |
CSubConIPAddressInfoParamSet* grantedIPAddressInfo = CSubConIPAddressInfoParamSet::NewL(ipAddressInfoFamily, RParameterFamily::EGranted);
|
|
577 |
|
|
578 |
if(grantedIPAddressInfo)
|
|
579 |
{
|
|
580 |
grantedIPAddressInfo->RemoveParamInfo(index);
|
|
581 |
|
|
582 |
iPacketFilterId.Remove(index);
|
|
583 |
iPacketFilterMaskId &= !(1 << aId);
|
|
584 |
}
|
|
585 |
else
|
|
586 |
{
|
|
587 |
User::Leave(KErrNotFound);
|
|
588 |
}
|
|
589 |
}
|
|
590 |
else
|
|
591 |
{
|
|
592 |
User::Leave(KErrNotFound);
|
|
593 |
}
|
|
594 |
}
|
|
595 |
}
|