20 */ |
20 */ |
21 |
21 |
22 #include <comms-infras/ss_log.h> |
22 #include <comms-infras/ss_log.h> |
23 #include <elements/sm_core.h> |
23 #include <elements/sm_core.h> |
24 #include <comms-infras/corecpractivities.h> |
24 #include <comms-infras/corecpractivities.h> |
|
25 #include <comms-infras/ss_corepractivities.h> |
25 |
26 |
26 #include "tunnelagentcpr.h" |
27 #include "tunnelagentcpr.h" |
27 #include "tunnelagentcprstates.h" |
28 #include "tunnelagentcprstates.h" |
28 #include <comms-infras/agentmessages.h> |
29 #include <comms-infras/agentmessages.h> |
29 #include <comms-infras/agentcprstates.h> |
30 #include <comms-infras/agentcprstates.h> |
43 using namespace MeshMachine; |
44 using namespace MeshMachine; |
44 using namespace ESock; |
45 using namespace ESock; |
45 using namespace NetStateMachine; |
46 using namespace NetStateMachine; |
46 using namespace AgentCprStates; |
47 using namespace AgentCprStates; |
47 using namespace TunnelAgentCprStates; |
48 using namespace TunnelAgentCprStates; |
48 |
|
49 //We reserve space for two preallocated activities that may start concurrently on the CPR |
|
50 //node: destroy and data client stop. |
|
51 static const TUint KDefaultMaxPreallocatedActivityCount = 2; |
|
52 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); |
|
53 static const TUint KTunnelCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; |
|
54 |
49 |
55 namespace TunnelAgentCprStartActivity |
50 namespace TunnelAgentCprStartActivity |
56 { |
51 { |
57 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, TunnelCprStart, TCFServiceProvider::TStart, PRActivities::CStartActivity::NewL) |
52 DECLARE_DEFINE_CUSTOM_NODEACTIVITY(ECFActivityStart, TunnelCprStart, TCFServiceProvider::TStart, PRActivities::CStartActivity::NewL) |
58 FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, CoreNetStates::TNoTagBlockedByStop) |
53 FIRST_NODEACTIVITY_ENTRY(CoreNetStates::TAwaitingStart, CoreNetStates::TNoTagBlockedByStop) |
101 */ |
96 */ |
102 EXPORT_C CTunnelAgentConnectionProvider* CTunnelAgentConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory) |
97 EXPORT_C CTunnelAgentConnectionProvider* CTunnelAgentConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory) |
103 { |
98 { |
104 CTunnelAgentConnectionProvider* self = new (ELeave) CTunnelAgentConnectionProvider(aFactory); |
99 CTunnelAgentConnectionProvider* self = new (ELeave) CTunnelAgentConnectionProvider(aFactory); |
105 CleanupStack::PushL(self); |
100 CleanupStack::PushL(self); |
106 self->ConstructL(KTunnelCPRPreallocatedActivityBufferSize); |
101 self->ConstructL(); |
107 CleanupStack::Pop(self); |
102 CleanupStack::Pop(self); |
108 return self; |
103 return self; |
109 } |
104 } |
110 |
105 |
111 |
106 |
112 CTunnelAgentConnectionProvider::CTunnelAgentConnectionProvider(CConnectionProviderFactoryBase& aFactory) |
107 CTunnelAgentConnectionProvider::CTunnelAgentConnectionProvider(CConnectionProviderFactoryBase& aFactory) |
113 : CAgentConnectionProvider(aFactory, TunnelAgentCprStates::TunnelAgentCprActivities::Self()) |
108 : CAgentConnectionProvider(aFactory, TunnelAgentCprStates::TunnelAgentCprActivities::Self()), |
|
109 TIfStaticFetcherNearestInHierarchy(this) |
114 { |
110 { |
115 LOG_NODE_CREATE(KTunnelAgentCprTag, CTunnelAgentConnectionProvider); |
111 LOG_NODE_CREATE(KTunnelAgentCprTag, CTunnelAgentConnectionProvider); |
116 } |
112 } |
117 |
113 |
118 |
114 |
122 EXPORT_C CTunnelAgentConnectionProvider::~CTunnelAgentConnectionProvider() |
118 EXPORT_C CTunnelAgentConnectionProvider::~CTunnelAgentConnectionProvider() |
123 { |
119 { |
124 LOG_NODE_DESTROY(KTunnelAgentCprTag, CTunnelAgentConnectionProvider); |
120 LOG_NODE_DESTROY(KTunnelAgentCprTag, CTunnelAgentConnectionProvider); |
125 } |
121 } |
126 |
122 |
|
123 // |
|
124 // MPlatSecApiExt |
|
125 // |
127 |
126 |
|
127 void CTunnelAgentConnectionProvider::ReturnInterfacePtrL(MPlatsecApiExt*& aInterface) |
|
128 { |
|
129 aInterface = this; |
|
130 } |
128 |
131 |
|
132 TInt CTunnelAgentConnectionProvider::SecureId(TSecureId& /*aResult*/) const |
|
133 { |
|
134 return KErrNotSupported; |
|
135 } |
|
136 |
|
137 TInt CTunnelAgentConnectionProvider::VendorId(TVendorId& /*aResult*/) const |
|
138 { |
|
139 return KErrNotSupported; |
|
140 } |
|
141 |
|
142 TBool CTunnelAgentConnectionProvider::HasCapability(const TCapability /*aCapability*/) const |
|
143 { |
|
144 return KErrNotSupported; |
|
145 } |
|
146 |
|
147 TInt CTunnelAgentConnectionProvider::CheckPolicy(const TSecurityPolicy& /*aPolicy*/) const |
|
148 { |
|
149 // This is the whole reason that we need to implement MPlatSecApiExt in this node at all. When TunnelAgentCpr issues |
|
150 // a TStop towards IpCpr, IpCpr requires the sending node (normally ESockSvr but TunnelAgentCpr in this case) |
|
151 // to implement MPlatSecApiExt through which IpCpr can check platsec capabilities (IpCprStates::TCheckStopCapabilities). |
|
152 // If TunnelAgentCpr does not impement MPlatSecApiExt, then IpCpr will error the stop request with KErrInterfaceNotSupported. |
|
153 return KErrNone; |
|
154 } |