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 MCPR
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@internalComponent
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include <etelqos.h>
|
|
24 |
#include <comms-infras/agentmcpractivities.h>
|
|
25 |
#include <comms-infras/coremcpractivities.h>
|
|
26 |
#include <comms-infras/ss_msgintercept.h>
|
|
27 |
#include <elements/nm_messages_errorrecovery.h>
|
|
28 |
#include <comms-infras/ss_log.h>
|
|
29 |
#include "pdpmcpr.h"
|
|
30 |
#include "pdpmcprstates.h"
|
|
31 |
#include "PDPProvision.h"
|
|
32 |
#include "psdavailabilitylistener.h"
|
|
33 |
#include "pdp.hrh"
|
|
34 |
|
|
35 |
using namespace Messages;
|
|
36 |
using namespace MeshMachine;
|
|
37 |
using namespace ESock;
|
|
38 |
using namespace NetStateMachine;
|
|
39 |
using namespace MCprActivities;
|
|
40 |
|
|
41 |
|
|
42 |
// No Bearer Activity
|
|
43 |
namespace PdpMCPRNoBearerActivity
|
|
44 |
{
|
|
45 |
DECLARE_DEFINE_NODEACTIVITY(ECFActivityNoBearer, activity, TCFControlProvider::TNoBearer)
|
|
46 |
FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingNoBearer, MeshMachine::TNoTag)
|
|
47 |
LAST_NODEACTIVITY_ENTRY(KNoTag, CoreNetStates::TSendBearer)
|
|
48 |
NODEACTIVITY_END()
|
|
49 |
}
|
|
50 |
|
|
51 |
namespace PdpMCprErrorRecoveryActivity
|
|
52 |
{
|
|
53 |
DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityErrorRecovery, PdpMCprErrorRecovery, TEErrorRecovery::TErrorRecoveryRequest, CPdpErrorRecoveryActivity::NewL)
|
|
54 |
FIRST_NODEACTIVITY_ENTRY(MCprStates::TAwaitingErrorRecoveryRequest, MeshMachine::TNoTag)
|
|
55 |
THROUGH_NODEACTIVITY_ENTRY(KNoTag, CPdpErrorRecoveryActivity::TProcessErrorRecoveryReq, CPdpErrorRecoveryActivity::TPdpContentionNoTagOrError)
|
|
56 |
NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing, CPdpErrorRecoveryActivity::TAwaitingContentionResult, MeshMachine::TNoTag)
|
|
57 |
LAST_NODEACTIVITY_ENTRY(KNoTag, CPdpErrorRecoveryActivity::TProcessContentionResult)
|
|
58 |
LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TDoNothing)
|
|
59 |
NODEACTIVITY_END()
|
|
60 |
}
|
|
61 |
|
|
62 |
// Activity Map
|
|
63 |
namespace PdpMCprStates
|
|
64 |
{
|
|
65 |
DECLARE_DEFINE_ACTIVITY_MAP(stateMap)
|
|
66 |
ACTIVITY_MAP_ENTRY(PdpMCPRNoBearerActivity, activity)
|
|
67 |
ACTIVITY_MAP_ENTRY(PdpMCprErrorRecoveryActivity, PdpMCprErrorRecovery)
|
|
68 |
ACTIVITY_MAP_END_BASE(AgentMCprActivities, agentMCprActivities)
|
|
69 |
} // namespace PdpMCprStates
|
|
70 |
|
|
71 |
namespace PdpMCprErrorRecoveryActivity
|
|
72 |
{
|
|
73 |
CNodeActivityBase* CPdpErrorRecoveryActivity::NewL( const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode )
|
|
74 |
{
|
|
75 |
TUint c = GetNextActivityCountL(aActivitySig,aNode);
|
|
76 |
return new(ELeave)CPdpErrorRecoveryActivity(aActivitySig, aNode, c);
|
|
77 |
}
|
|
78 |
|
|
79 |
CPdpErrorRecoveryActivity::CPdpErrorRecoveryActivity(const MeshMachine::TNodeActivity& aActivitySig, MeshMachine::AMMNodeBase& aNode, TUint aActivitiesCount)
|
|
80 |
: MeshMachine::CNodeParallelActivityBase(aActivitySig, aNode, aActivitiesCount)
|
|
81 |
{
|
|
82 |
}
|
|
83 |
|
|
84 |
CPdpErrorRecoveryActivity::~CPdpErrorRecoveryActivity()
|
|
85 |
{
|
|
86 |
}
|
|
87 |
}
|
|
88 |
|
|
89 |
//-=========================================================
|
|
90 |
//
|
|
91 |
//CPdpMetaConnectionProvider implementation
|
|
92 |
//
|
|
93 |
//-=========================================================
|
|
94 |
|
|
95 |
CPdpMetaConnectionProvider* CPdpMetaConnectionProvider::NewL(ESock::CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo)
|
|
96 |
{
|
|
97 |
// coverity[alloc_fn] coverity[alias] coverity[assign]
|
|
98 |
CPdpMetaConnectionProvider* provider = new (ELeave) CPdpMetaConnectionProvider(aFactory, aProviderInfo);
|
|
99 |
// coverity[push]
|
|
100 |
CleanupStack::PushL(provider);
|
|
101 |
// coverity[alias] coverity[double_push]
|
|
102 |
provider->ConstructL();
|
|
103 |
CleanupStack::Pop(provider);
|
|
104 |
return provider;
|
|
105 |
}
|
|
106 |
|
|
107 |
void CPdpMetaConnectionProvider::ConstructL()
|
|
108 |
{
|
|
109 |
CAgentMetaConnectionProvider::ConstructL();
|
|
110 |
|
|
111 |
const TLayerConfig* layerCfg = static_cast<const TLayerConfig*>(AccessPointConfig().FindExtension(
|
|
112 |
STypeId::CreateSTypeId(TLayerConfig::EUid,TLayerConfig::ETypeId)));
|
|
113 |
|
|
114 |
// defensive programming. If the layer cfg isn't here
|
|
115 |
// then this is really corrupt.
|
|
116 |
|
|
117 |
if (layerCfg == NULL)
|
|
118 |
{
|
|
119 |
User::Leave(KErrCorrupt);
|
|
120 |
}
|
|
121 |
|
|
122 |
// these constants and all of the implementation ids should be in a header file
|
|
123 |
// and included in the .rss / ecom files.
|
|
124 |
|
|
125 |
// Any layer that uses an outbound PDP.SCPR will have information that is overwritten by
|
|
126 |
// the network (for example, negotiated parameters), this configuration information is
|
|
127 |
// local to the connection and should not be created here. So this check is to ensure
|
|
128 |
// that legacy behaviour is maintained for any layer that uses this MCPR but not a
|
|
129 |
// PDP.SCPR. But the PDP.SCPR behaviour has been modified to create the information
|
|
130 |
// that is local to that connection.
|
|
131 |
|
|
132 |
if (layerCfg->SCprUid().iUid == PDPScprImplUid)
|
|
133 |
{
|
|
134 |
// the PDP layer MCPR is being used in conjunction with a PDP.SCPR
|
|
135 |
// in this case we can rightly assume that the PDP.SCPR will create
|
|
136 |
// the access point config for that connection.
|
|
137 |
// code from the PDP.SCPR will need to be moved into the PDP.CPR when
|
|
138 |
// that component becomes available for use.
|
|
139 |
ConfigurePDPLayerL();
|
|
140 |
}
|
|
141 |
else
|
|
142 |
{
|
|
143 |
// non-PDP.SCPR specific behaviour
|
|
144 |
// this is legacy for any layers that are constructed expecting the previous behaviour
|
|
145 |
SetAccessPointConfigFromDbL();
|
|
146 |
}
|
|
147 |
}
|
|
148 |
|
|
149 |
CPdpMetaConnectionProvider::CPdpMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo)
|
|
150 |
: CAgentMetaConnectionProvider(aFactory, aProviderInfo, PdpMCprStates::stateMap::Self())
|
|
151 |
{
|
|
152 |
LOG_NODE_CREATE(KPdpMCprSubTag, CPdpMetaConnectionProvider);
|
|
153 |
}
|
|
154 |
|
|
155 |
CPdpMetaConnectionProvider::~CPdpMetaConnectionProvider()
|
|
156 |
{
|
|
157 |
CPdpMetaConnectionProvider::CancelAvailabilityMonitoring(); //Don't call virtual for obvious reasons!
|
|
158 |
LOG_NODE_DESTROY(KPdpMCprSubTag, CPdpMetaConnectionProvider);
|
|
159 |
}
|
|
160 |
|
|
161 |
void CPdpMetaConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage)
|
|
162 |
{
|
|
163 |
__CFLOG_VAR((KPdpMCprTag, KPdpMCprSubTag, _L8("CPdpMetaConnectionProvider [this=%08x]::ReceivedL() aMessage=%d"),
|
|
164 |
this, aMessage.MessageId().MessageId()));
|
|
165 |
|
|
166 |
ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient);
|
|
167 |
|
|
168 |
TNodeContext<CPdpMetaConnectionProvider> ctx(*this, aMessage, aSender, aRecipient);
|
|
169 |
CCoreMetaConnectionProvider::Received(ctx);
|
|
170 |
User::LeaveIfError(ctx.iReturn);
|
|
171 |
}
|
|
172 |
|
|
173 |
|
|
174 |
void CPdpMetaConnectionProvider::ConfigurePDPLayerL()
|
|
175 |
{
|
|
176 |
RMetaExtensionContainer mec;
|
|
177 |
mec.Open(AccessPointConfig());
|
|
178 |
CleanupClosePushL(mec);
|
|
179 |
|
|
180 |
CCommsDatIapView* iapView = OpenIapViewLC();
|
|
181 |
|
|
182 |
|
|
183 |
mec.AppendExtensionL(CTSYProvision::NewLC(iapView));
|
|
184 |
CleanupStack::Pop();
|
|
185 |
|
|
186 |
mec.AppendExtensionL(CPppLcpConfig::NewLC(iapView));
|
|
187 |
CleanupStack::Pop();
|
|
188 |
mec.AppendExtensionL(CPppAuthConfig::NewLC(iapView));
|
|
189 |
CleanupStack::Pop();
|
|
190 |
|
|
191 |
CPppProvisionInfo* agentProvision = new (ELeave) CPppProvisionInfo;
|
|
192 |
CleanupStack::PushL(agentProvision);
|
|
193 |
agentProvision->SetIsDialIn(KErrNotSupported);
|
|
194 |
agentProvision->SetNotificationData(NULL);
|
|
195 |
mec.AppendExtensionL(agentProvision);
|
|
196 |
CleanupStack::Pop(agentProvision);
|
|
197 |
|
|
198 |
CleanupStack::PopAndDestroy(); // CloseIapView();
|
|
199 |
|
|
200 |
iAccessPointConfig.Close();
|
|
201 |
iAccessPointConfig.Open(mec);
|
|
202 |
CleanupStack::PopAndDestroy(&mec);
|
|
203 |
}
|
|
204 |
|
|
205 |
void CPdpMetaConnectionProvider::SetAccessPointConfigFromDbL()
|
|
206 |
{
|
|
207 |
RMetaExtensionContainer mec;
|
|
208 |
mec.Open(AccessPointConfig());
|
|
209 |
CleanupClosePushL(mec);
|
|
210 |
|
|
211 |
CCommsDatIapView* iapView = OpenIapViewLC();
|
|
212 |
|
|
213 |
mec.AppendExtensionL(CIPConfig::NewFromGPRSOutLC(iapView));
|
|
214 |
CleanupStack::Pop();
|
|
215 |
mec.AppendExtensionL(CBCAProvision::NewLC(iapView));
|
|
216 |
CleanupStack::Pop();
|
|
217 |
mec.AppendExtensionL(CTSYProvision::NewLC(iapView));
|
|
218 |
CleanupStack::Pop();
|
|
219 |
mec.AppendExtensionL(CImsExtProvision::NewLC(iapView));
|
|
220 |
CleanupStack::Pop();
|
|
221 |
|
|
222 |
CGPRSProvision* gprsProvision = CGPRSProvision::NewLC(iapView);
|
|
223 |
mec.AppendExtensionL(gprsProvision);
|
|
224 |
CleanupStack::Pop(gprsProvision);
|
|
225 |
|
|
226 |
//It's not legal for the qos defaults to be absent.
|
|
227 |
CDefaultPacketQoSProvision* defaultQoS = NULL;
|
|
228 |
TRAPD(ret, defaultQoS = CDefaultPacketQoSProvision::NewL(iapView));
|
|
229 |
if ((KErrNone == ret) && defaultQoS)
|
|
230 |
{
|
|
231 |
CleanupStack::PushL(defaultQoS);
|
|
232 |
mec.AppendExtensionL(defaultQoS);
|
|
233 |
CleanupStack::Pop(defaultQoS);
|
|
234 |
}
|
|
235 |
else
|
|
236 |
{
|
|
237 |
if (KErrNoMemory == ret)
|
|
238 |
{
|
|
239 |
User::Leave(KErrNoMemory);
|
|
240 |
}
|
|
241 |
else
|
|
242 |
{
|
|
243 |
User::Leave(KErrCorrupt);
|
|
244 |
}
|
|
245 |
}
|
|
246 |
|
|
247 |
CRawIpAgentConfig* rawIpAgentConfig = CRawIpAgentConfig::NewLC(iapView, &gprsProvision->GetScratchContextAs<TPacketDataConfigBase>());
|
|
248 |
mec.AppendExtensionL(rawIpAgentConfig);
|
|
249 |
CleanupStack::Pop();
|
|
250 |
|
|
251 |
mec.AppendExtensionL(CPppLcpConfig::NewLC(iapView));
|
|
252 |
CleanupStack::Pop();
|
|
253 |
mec.AppendExtensionL(CPppAuthConfig::NewLC(iapView));
|
|
254 |
CleanupStack::Pop();
|
|
255 |
|
|
256 |
CPppProvisionInfo* agentProvision = new (ELeave) CPppProvisionInfo;
|
|
257 |
CleanupStack::PushL(agentProvision);
|
|
258 |
agentProvision->SetIsDialIn(KErrNotSupported);
|
|
259 |
agentProvision->SetNotificationData(NULL);
|
|
260 |
mec.AppendExtensionL(agentProvision);
|
|
261 |
CleanupStack::Pop(agentProvision);
|
|
262 |
|
|
263 |
CleanupStack::PopAndDestroy(); // CloseIapView();
|
|
264 |
|
|
265 |
iAccessPointConfig.Close();
|
|
266 |
iAccessPointConfig.Open(mec);
|
|
267 |
CleanupStack::PopAndDestroy(&mec);
|
|
268 |
}
|
|
269 |
|
|
270 |
void CPdpMetaConnectionProvider::StartAvailabilityMonitoringL(const TNodeCtxId& aAvailabilityActivity)
|
|
271 |
{
|
|
272 |
ASSERT(iAvailabilityListener==NULL); //Only one start allowed from the av activity!
|
|
273 |
const CTSYProvision& config = static_cast<const CTSYProvision&>(AccessPointConfig().FindExtensionL(STypeId::CreateSTypeId(CTSYProvision::EUid, CTSYProvision::ETypeId)));
|
|
274 |
iAvailabilityListener = CPsdAvailabilityListener::NewL(aAvailabilityActivity, config, ProviderInfo().APId(), GetTierManager()->IsUnavailableDueToContention(this));
|
|
275 |
AddClientL(iAvailabilityListener->Id(), TClientType(TCFClientType::ERegistrar, TCFClientType::EAvailabilityProvider));
|
|
276 |
}
|
|
277 |
|
|
278 |
void CPdpMetaConnectionProvider::CancelAvailabilityMonitoring()
|
|
279 |
{
|
|
280 |
if (iAvailabilityListener)
|
|
281 |
{
|
|
282 |
RemoveClient(iAvailabilityListener->Id());
|
|
283 |
iAvailabilityListener = NULL; //iAvailabilityListener will delete itself when cancelled from the availability activity
|
|
284 |
}
|
|
285 |
}
|
|
286 |
|
|
287 |
void CPdpMetaConnectionProvider::ContentionOccured()
|
|
288 |
{
|
|
289 |
// Send a stop request to the stop activity.
|
|
290 |
TInt stopCode = KErrConnectionContention;
|
|
291 |
RClientInterface::OpenPostMessageClose(NodeId(), NodeId(), TCFDataClient::TStop(stopCode).CRef());
|
|
292 |
}
|
|
293 |
|
|
294 |
void CPdpMetaConnectionProvider::ContentionResolved(const Messages::TNodeId& aPendingCprId, TBool aResult)
|
|
295 |
{
|
|
296 |
TPDPMessages::TPdpContentionResultMessage msg(aPendingCprId, aResult);
|
|
297 |
TRAP_IGNORE(ReceivedL(TNodeId(Id()), TNodeId(Id()), msg));
|
|
298 |
}
|
|
299 |
|
|
300 |
void CPdpMetaConnectionProvider::ReportContentionAvailabilityStatus(const TAvailabilityStatus& aAvailabilityStatus) const
|
|
301 |
{
|
|
302 |
if (iAvailabilityListener)
|
|
303 |
{
|
|
304 |
iAvailabilityListener->ReportContentionAvailabilityStatusIfRequired(aAvailabilityStatus);
|
|
305 |
}
|
|
306 |
}
|
|
307 |
|