|
1 // Copyright (c) 2007-2009 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 // NETMCPR.CPP |
|
15 // This is part of an ECOM plug-in |
|
16 // SIP Meta Conneciton Provider class definition |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file |
|
22 @internalComponent |
|
23 */ |
|
24 |
|
25 #include "sipmcpr.h" |
|
26 #include <comms-infras/ss_nodemessages_selector.h> |
|
27 #include <comms-infras/ss_corepractivities.h> |
|
28 #include <elements/mm_states.h> |
|
29 |
|
30 #ifdef __CFLOG_ACTIVE |
|
31 #define KSipMCprTag KESockMetaConnectionTag |
|
32 _LIT8(KSipMCprSubTag, "sipmcpr"); |
|
33 #endif |
|
34 |
|
35 using namespace ESock; |
|
36 using namespace NetStateMachine; |
|
37 using namespace Messages; |
|
38 using namespace MeshMachine; |
|
39 using namespace MCprActivities; |
|
40 using namespace PRActivities; |
|
41 using namespace CoreActivities; |
|
42 |
|
43 |
|
44 /* |
|
45 The problem is that we have a single dummy access point for sip. |
|
46 If I open 2 connection , ie 2 mcprs, the access point config is still shared. |
|
47 This becomes a problem because the the tierMgr instances set in the provision message |
|
48 will be of the same type. |
|
49 */ |
|
50 namespace SipMCprStates |
|
51 { |
|
52 DEFINE_SMELEMENT(TSendProvision, NetStateMachine::MStateTransition, SipMCprStates::TContext) |
|
53 void SipMCprStates::TSendProvision::DoL() |
|
54 { |
|
55 PRStates::TSendProvision mcprSendProvision(iContext); |
|
56 mcprSendProvision.DoL(); |
|
57 } |
|
58 } |
|
59 |
|
60 // Default activity is overriden here. SIP MCPR needs to extend the access point config |
|
61 // with SIP MCPR provision info(Appuid, ProfileID and TransitionEngine Mgr). This extended |
|
62 // Provision info will be sent in provision messages SendProvision::DoL() |
|
63 namespace SipMCprBinderRequestActivity |
|
64 { |
|
65 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityBinderRequest, SipMCprBinderRequest, TCFServiceProvider::TCommsBinderRequest, CCommsBinderActivity::NewL) |
|
66 FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingBinderRequest, CCommsBinderActivity::TNoTagOrUseExistingBlockedByBinderRequest) |
|
67 NODEACTIVITY_ENTRY(KNoTag, PRStates::TCreateDataClient, CoreNetStates::TAwaitingDataClientJoin, MeshMachine::TNoTag) |
|
68 |
|
69 THROUGH_NODEACTIVITY_ENTRY(KNoTag, SipMCprStates::TProcessCprCreation, MeshMachine::TTag<CoreStates::KUseExisting>) |
|
70 NODEACTIVITY_ENTRY(CoreStates::KUseExisting, PRActivities::CCommsBinderActivity::TSendBinderResponse, PRActivities::CCommsBinderActivity::TAwaitingBindToComplete, MeshMachine::TNoTagOrErrorTag) |
|
71 LAST_NODEACTIVITY_ENTRY(KNoTag, MeshMachine::TDoNothing) |
|
72 LAST_NODEACTIVITY_ENTRY(KErrorTag, MeshMachine::TClearError) |
|
73 NODEACTIVITY_END() |
|
74 } |
|
75 |
|
76 // For the SIP there is no below layer. Send Select complete when this msg is received |
|
77 namespace SipMCprSelectNextLayerActivity |
|
78 { |
|
79 DECLARE_DEFINE_NODEACTIVITY(ECFActivitySelect, SipMCprSelectNextLayer, TCFSelector::TSimpleSelect) |
|
80 FIRST_NODEACTIVITY_ENTRY(MCprStates::TAwaitingSelectNextLayer, MeshMachine::TNoTag) |
|
81 LAST_NODEACTIVITY_ENTRY(KNoTag, MCprStates::TSendFinalSelectComplete) |
|
82 NODEACTIVITY_END() |
|
83 } |
|
84 |
|
85 namespace SipMcpr |
|
86 { |
|
87 DEFINE_EXPORT_ACTIVITY_MAP(SipMcprActivities) |
|
88 ACTIVITY_MAP_ENTRY(SipMCprBinderRequestActivity, SipMCprBinderRequest) |
|
89 ACTIVITY_MAP_ENTRY(SipMCprSelectNextLayerActivity,SipMCprSelectNextLayer) |
|
90 ACTIVITY_MAP_END_BASE(PRActivities, coreActivitiesMCpr) |
|
91 } |
|
92 |
|
93 // |
|
94 //CSipMetaConnectionProvider |
|
95 CSipMetaConnectionProvider* CSipMetaConnectionProvider::NewL(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo) |
|
96 { |
|
97 __CFLOG_VAR((KSipMCprTag, KSipMCprSubTag, _L8("CSipMetaConnectionProvider:\tNewL()"))); |
|
98 CSipMetaConnectionProvider* self = new (ELeave) CSipMetaConnectionProvider(aFactory,aProviderInfo,SipMcpr::SipMcprActivities::Self()); |
|
99 CleanupStack::PushL(self); |
|
100 self->ConstructL(aProviderInfo); |
|
101 CleanupStack::Pop(self); |
|
102 return self; |
|
103 } |
|
104 |
|
105 CSipMetaConnectionProvider::CSipMetaConnectionProvider(CMetaConnectionProviderFactoryBase& aFactory, const TProviderInfo& aProviderInfo, const MeshMachine::TNodeActivityMap& aActivityMap) |
|
106 : CCoreMetaConnectionProvider(aFactory,aProviderInfo,aActivityMap) |
|
107 |
|
108 { |
|
109 LOG_NODE_CREATE(KSipMCprTag, CSipMetaConnectionProvider); |
|
110 } |
|
111 |
|
112 CSipMetaConnectionProvider::~CSipMetaConnectionProvider() |
|
113 { |
|
114 LOG_NODE_DESTROY(KSipMCprTag, CSipMetaConnectionProvider); |
|
115 } |
|
116 |
|
117 void CSipMetaConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) |
|
118 { |
|
119 //@TODO log |
|
120 // __CFLOG_VAR((KSipMCprTag, KSipMCprSubTag, _L8("CSipMetaConnectionProvider %08x:\tReceivedL() aCFMessage=%d"), |
|
121 // this, aCFMessage.MessageId().MessageId())); |
|
122 TNodeContext<CSipMetaConnectionProvider> ctx(*this, aMessage, aSender, aRecipient); |
|
123 CCoreMetaConnectionProvider::Received(ctx); |
|
124 User::LeaveIfError(ctx.iReturn); |
|
125 } |
|
126 |
|
127 |
|
128 void CSipMetaConnectionProvider::ConstructL(const ESock::TProviderInfo& aProviderInfo) |
|
129 { |
|
130 CMetaConnectionProviderBase::ConstructL(); //This initialises the AccessPointInfo |
|
131 |
|
132 // Set the SIP Provision info |
|
133 if (aProviderInfo.Instance()!= NULL) |
|
134 { |
|
135 TSipMcprProvisionInfo* sipext = reinterpret_cast<TSipMcprProvisionInfo *>(aProviderInfo.Instance()); |
|
136 SetAppUid(sipext->iAppUid); |
|
137 SetProfileId(sipext->iProfileId); |
|
138 SetTransitionEngineManager(sipext->iTransitionEngineMgr); |
|
139 } |
|
140 |
|
141 //For construction of IpProto providers (construction only) we use the instance field of TProviderInfo |
|
142 //to carry the IAP id. The IAP id is necessary for the initialisation if IpProto specific data. |
|
143 //TInt iap = (TInt)ProviderInfo().Instance(); // instance is set to null and hence the iap also will be null |
|
144 TInt iap = (TInt)ProviderInfo().APId(); |
|
145 SetProviderInfo(TProviderInfo(ProviderInfo().TierId(),iap)); |
|
146 SetConfigL(); |
|
147 } |
|
148 |
|
149 void CSipMetaConnectionProvider::SetConfigL() |
|
150 { |
|
151 TSipMcprProvisionInfo* iProvisionInfo = new (ELeave) TSipMcprProvisionInfo(); |
|
152 iProvisionInfo->iAppUid = iAppUid; |
|
153 iProvisionInfo->iProfileId = iProfileId; |
|
154 iProvisionInfo->iTransitionEngineMgr = iTransitionEngineMgr; |
|
155 |
|
156 // Append the above three to the accesspointconfig and send to CPR in ProvisionConfig message |
|
157 |
|
158 RMetaExtensionContainer mec; |
|
159 mec.Open(AccessPointConfig()); |
|
160 CleanupClosePushL(mec); |
|
161 CleanupStack::PushL(iProvisionInfo); |
|
162 mec.AppendExtensionL(iProvisionInfo); |
|
163 CleanupStack::Pop(iProvisionInfo); |
|
164 AccessPointConfig().Close(); |
|
165 AccessPointConfig().Open(mec); |
|
166 CleanupStack::PopAndDestroy(&mec); |
|
167 } |