|
1 // Copyright (c) 2005-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 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalComponent |
|
19 */ |
|
20 #include "ss_nodemessages_legacy.h" |
|
21 |
|
22 #include <comms-infras/api_ext_list.h> |
|
23 #include <comms-infras/api_ext_msg.h> |
|
24 #include <cdblen.h> |
|
25 #include <commdb.h> |
|
26 #include <ss_glob.h> |
|
27 #include <comms-infras/ss_connprov.h> |
|
28 #include "ss_connstates.h" |
|
29 #include <comms-infras/ss_connlegacy.h> |
|
30 #include <comms-infras/ss_thread.h> |
|
31 #include <comms-infras/metatype.h> |
|
32 #include <comms-infras/ss_datamon_apiext.h> |
|
33 #include <comms-infras/ss_connlegacy.h> |
|
34 #include "SS_conn.H" |
|
35 |
|
36 #include <comms-infras/ss_nodemessages_internal_esock.h> |
|
37 #include "ss_internal_activities.h" |
|
38 // although we don't need the XConnectionQueryBase::LoadL() method |
|
39 // including this header forces us to link against commsdataobjects.lib |
|
40 // when compiling with Armv5 |
|
41 #include <comms-infras/connectionqueryset.h> |
|
42 |
|
43 #include <comms-infras/ss_log.h> |
|
44 #include <comms-infras/ss_commsdataobject.h> |
|
45 #include <comms-infras/ss_roles.h> |
|
46 #include <ss_sock.h> |
|
47 #include "SS_rslv.H" |
|
48 #include <comms-infras/ss_subconnflow.h> |
|
49 #include <elements/responsemsg.h> |
|
50 |
|
51 #ifdef __CFLOG_ACTIVE |
|
52 #define KShimCprTag KESockConnectionTag |
|
53 _LIT8(KShimCprSubTag, "shimcpr"); // logging tag |
|
54 #endif |
|
55 |
|
56 using namespace ESock; |
|
57 using namespace Elements; |
|
58 using namespace Messages; |
|
59 using namespace MeshMachine; |
|
60 |
|
61 |
|
62 /** |
|
63 * TCFSigLegacyRMessage2Ext |
|
64 */ |
|
65 TCFSigLegacyRMessage2Ext::TCFSigLegacyRMessage2Ext() |
|
66 : Messages::TSignatureBase() {} |
|
67 |
|
68 TCFSigLegacyRMessage2Ext::TCFSigLegacyRMessage2Ext(const Messages::TNodeSignal::TMessageId& aMessageId, const Den::RSafeMessage& aMessage) |
|
69 : Messages::TSignatureBase(aMessageId), iMessage() { iMessage.Duplicate(aMessage); } |
|
70 |
|
71 TBool TCFSigLegacyRMessage2Ext::HasInterface(MeshMachine::TNodeContextBase& aContext, TInt aInterface) |
|
72 { |
|
73 TRAPD(err, FetchInterfaceL(aContext.Node(), aInterface)); |
|
74 |
|
75 if (err != KErrNone) |
|
76 { |
|
77 return EFalse; |
|
78 } |
|
79 else |
|
80 { |
|
81 return ETrue; |
|
82 } |
|
83 } |
|
84 |
|
85 TAny* TCFSigLegacyRMessage2Ext::FetchInterfaceL(MeshMachine::AMMNodeBase& aNode, TInt aInterface) |
|
86 { |
|
87 NetInterfaces::TInterfaceControl* ic = NULL; |
|
88 ic = aNode.Id().Node().FetchNodeInterfaceControlL(aInterface); |
|
89 |
|
90 return ic->FetchInterfaceL(aInterface); |
|
91 } |
|
92 |
|
93 TAny* TCFSigLegacyRMessage2Ext::FetchInterfaceL(Messages::ANode& aNode, TInt aInterface) |
|
94 { |
|
95 NetInterfaces::TInterfaceControl* ic = NULL; |
|
96 ic = aNode.FetchNodeInterfaceControlL(aInterface); |
|
97 |
|
98 return ic->FetchInterfaceL(aInterface); |
|
99 } |
|
100 |
|
101 void TCFSigLegacyRMessage2Ext::ForwardRequestL(MeshMachine::TNodeContextBase& aContext) |
|
102 { |
|
103 ASSERT(aContext.Activity() != NULL); |
|
104 RNodeInterface* rcpt = NULL; |
|
105 |
|
106 /* At the connection level we want to go down active serviceprovider, as there are multiple |
|
107 and the first one is usually an scpr */ |
|
108 if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler) |
|
109 { |
|
110 rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EActive), |
|
111 Messages::TClientType(0, Messages::TClientType::ELeaving)); |
|
112 } |
|
113 else |
|
114 { |
|
115 rcpt = aContext.Node().GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider), |
|
116 Messages::TClientType(0, Messages::TClientType::ELeaving)); |
|
117 } |
|
118 |
|
119 if(rcpt) |
|
120 { |
|
121 aContext.Activity()->PostRequestTo(*rcpt, *this); |
|
122 } |
|
123 else |
|
124 { |
|
125 User::Leave(KErrNotFound); |
|
126 } |
|
127 |
|
128 } |
|
129 |
|
130 EXPORT_C TInt TCFSigLegacyRMessage2PlatsecExt::SecureId(TSecureId& aResult) const |
|
131 { |
|
132 aResult = iMessage.SecureId(); |
|
133 |
|
134 return KErrNone; |
|
135 } |
|
136 |
|
137 EXPORT_C TInt TCFSigLegacyRMessage2PlatsecExt::VendorId(TVendorId& aResult) const |
|
138 { |
|
139 aResult = iMessage.VendorId(); |
|
140 |
|
141 return KErrNone; |
|
142 } |
|
143 |
|
144 EXPORT_C TBool TCFSigLegacyRMessage2PlatsecExt::HasCapability(const TCapability aCapability) const |
|
145 { |
|
146 return iMessage.HasCapability(aCapability); |
|
147 } |
|
148 |
|
149 EXPORT_C TInt TCFSigLegacyRMessage2PlatsecExt::CheckPolicy(const TSecurityPolicy& aPolicy) const |
|
150 { |
|
151 TBool platsecResult; |
|
152 platsecResult = aPolicy.CheckPolicy(iMessage); |
|
153 if (!platsecResult) |
|
154 { |
|
155 return KErrPermissionDenied; |
|
156 } |
|
157 return KErrNone; |
|
158 } |
|
159 |
|
160 /** |
|
161 * |
|
162 * TMCprGetConnectionSetting |
|
163 * |
|
164 */ |
|
165 TBool TMCprGetConnectionSetting::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
166 { |
|
167 return HasInterface(aContext, MLinkMCprLegacyDataAccessApiExt::KInterfaceId); |
|
168 } |
|
169 |
|
170 void TMCprGetConnectionSetting::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
171 { |
|
172 if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler) |
|
173 { |
|
174 TClientIter<TDefaultClientMatchPolicy> iter = aContext.Node().GetClientIter<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider, TCFClientType::EAvailabilityProvider)); |
|
175 RNodeInterface* sp = iter[0]; |
|
176 |
|
177 if (!sp) |
|
178 { |
|
179 User::Leave(KErrNotReady); |
|
180 } |
|
181 |
|
182 aContext.Activity()->PostRequestTo(*sp, *this); |
|
183 } |
|
184 else |
|
185 { |
|
186 ForwardRequestL(aContext); |
|
187 } |
|
188 } |
|
189 |
|
190 void TMCprGetConnectionSetting::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
191 { |
|
192 TAny* interface = FetchInterfaceL(aContext.Node(), MLinkMCprLegacyDataAccessApiExt::KInterfaceId); |
|
193 ASSERT(interface); |
|
194 |
|
195 MLinkMCprLegacyDataAccessApiExt& dataAccessItf = *static_cast<MLinkMCprLegacyDataAccessApiExt*>(interface); |
|
196 |
|
197 TBuf<KCommsDbSvrMaxColumnNameLength*2 +1> field; |
|
198 iMessage.ReadL(0, field); |
|
199 |
|
200 switch (iSettingType) |
|
201 { |
|
202 case EIntSetting: |
|
203 { |
|
204 TUint32 value(0); |
|
205 dataAccessItf.GetIntSettingL(field, value, this); |
|
206 TPckg<TUint32> pckg(value); |
|
207 iMessage.WriteL(1, pckg); |
|
208 } |
|
209 break; |
|
210 |
|
211 case EBoolSetting: |
|
212 { |
|
213 TBool value(EFalse); |
|
214 dataAccessItf.GetBoolSettingL(field, value, this); |
|
215 TPckg<TBool> pckg(value); |
|
216 iMessage.WriteL(1, pckg); |
|
217 } |
|
218 break; |
|
219 |
|
220 case EDes8Setting: |
|
221 { |
|
222 TBuf8<KCommsDbSvrMaxFieldLength> value; |
|
223 dataAccessItf.GetDes8SettingL(field, value, this); |
|
224 iMessage.WriteL(1, value); |
|
225 } |
|
226 break; |
|
227 |
|
228 case EDes16Setting: |
|
229 { |
|
230 TBuf16<KCommsDbSvrRealMaxFieldLength> value; |
|
231 dataAccessItf.GetDes16SettingL(field, value, this); |
|
232 iMessage.WriteL(1, value); |
|
233 } |
|
234 break; |
|
235 |
|
236 case ELongDesSetting: |
|
237 { |
|
238 HBufC* valueBuf(NULL); |
|
239 dataAccessItf.GetLongDesSettingL(field, valueBuf, this); |
|
240 CleanupStack::PushL(valueBuf); |
|
241 TPtr valuePtr(valueBuf->Des()); |
|
242 iMessage.WriteL(1,valuePtr); |
|
243 CleanupStack::PopAndDestroy(valueBuf); |
|
244 } |
|
245 break; |
|
246 |
|
247 default: |
|
248 // Should never be able to reach here |
|
249 __ASSERT_ALWAYS(EFalse, User::Panic(_L("LegacyDataAccess"), KErrArgument)); |
|
250 break; |
|
251 } |
|
252 |
|
253 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprGetConnectionSetting %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
254 this, iMessage.Handle())); |
|
255 |
|
256 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
257 responseMsg.Complete(KErrNone); |
|
258 } |
|
259 |
|
260 /** |
|
261 * |
|
262 * TCprRetrieveProgress |
|
263 * |
|
264 */ |
|
265 TBool TCprRetrieveProgress::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
266 { |
|
267 return HasInterface(aContext, MLinkCprApiExt::KInterfaceId); |
|
268 } |
|
269 |
|
270 void TCprRetrieveProgress::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
271 { |
|
272 ForwardRequestL(aContext); |
|
273 } |
|
274 |
|
275 void TCprRetrieveProgress::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
276 { |
|
277 TAny* interface = NULL; |
|
278 TRAPD(err, interface = FetchInterfaceL(aContext.Node(), MLinkCprApiExt::KInterfaceId)); |
|
279 ASSERT(interface); |
|
280 |
|
281 MLinkCprApiExt::TProgressBuf prog; |
|
282 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
283 |
|
284 if (err == KErrNotFound) |
|
285 { |
|
286 // If an interface can't be found complete the client with the last |
|
287 // progress cached on the CConnection |
|
288 MLinkCprApiExt::TProgressBuf prog(iLastProgress); |
|
289 responseMsg.WriteL(0, prog); |
|
290 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprRetrieveProgress %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
291 this, iMessage.Handle())); |
|
292 responseMsg.Complete(KErrNone); |
|
293 return; |
|
294 } |
|
295 |
|
296 if (interface) |
|
297 { |
|
298 MLinkCprApiExt& linkCprItf = *static_cast<MLinkCprApiExt*>(interface); |
|
299 linkCprItf.ProgressL(prog); |
|
300 responseMsg.WriteL(0, prog); |
|
301 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprRetrieveProgress %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
302 this, iMessage.Handle())); |
|
303 responseMsg.Complete(KErrNone); |
|
304 } |
|
305 } |
|
306 |
|
307 TInt TCprRetrieveProgress::CheckError(MeshMachine::TNodeContextBase& aContext, TInt aError) |
|
308 { |
|
309 CConnection* conn = static_cast<CConnection*>(&aContext.Node()); |
|
310 ConnActivities::CConnLegacyRMessage2Activity* act = static_cast<ConnActivities::CConnLegacyRMessage2Activity*>(aContext.Activity()); |
|
311 if (aError == KErrNotFound) |
|
312 { |
|
313 TPckgBuf<TStateChange> progressBuf; |
|
314 progressBuf().iStage = conn->iLastProgress.iStage; |
|
315 progressBuf().iError = conn->iLastProgress.iError; |
|
316 |
|
317 TRAPD(err, act->iSafeMessage.WriteL(0, progressBuf)); |
|
318 return err; |
|
319 } |
|
320 |
|
321 return aError; |
|
322 } |
|
323 |
|
324 /** |
|
325 * |
|
326 * TCprRetrieveLastProgressError |
|
327 * |
|
328 */ |
|
329 TBool TCprRetrieveLastProgressError::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
330 { |
|
331 return HasInterface(aContext, MLinkCprApiExt::KInterfaceId); |
|
332 } |
|
333 |
|
334 void TCprRetrieveLastProgressError::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
335 { |
|
336 ForwardRequestL(aContext); |
|
337 } |
|
338 |
|
339 void TCprRetrieveLastProgressError::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
340 { |
|
341 TAny* interface = NULL; |
|
342 TRAPD(err, interface = FetchInterfaceL(aContext.Node(), MLinkCprApiExt::KInterfaceId)); |
|
343 ASSERT(interface); |
|
344 |
|
345 MLinkCprApiExt::TProgressBuf prog; |
|
346 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
347 |
|
348 if (err == KErrNotFound) |
|
349 { |
|
350 // If an interface can't be found complete the client with the last |
|
351 // progress error cached on the CConnection |
|
352 MLinkCprApiExt::TProgressBuf prog(iLastProgressError); |
|
353 responseMsg.WriteL(0, prog); |
|
354 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprRetrieveLastProgressError %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
355 this, iMessage.Handle())); |
|
356 responseMsg.Complete(KErrNone); |
|
357 return; |
|
358 } |
|
359 |
|
360 if (interface) |
|
361 { |
|
362 MLinkCprApiExt& linkCprItf = *static_cast<MLinkCprApiExt*>(interface); |
|
363 linkCprItf.LastProgressError(prog); |
|
364 responseMsg.WriteL(0, prog); |
|
365 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprRetrieveLastProgressError %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
366 this, iMessage.Handle())); |
|
367 responseMsg.Complete(KErrNone); |
|
368 } |
|
369 } |
|
370 |
|
371 TInt TCprRetrieveLastProgressError::CheckError(MeshMachine::TNodeContextBase& aContext, TInt aError) |
|
372 { |
|
373 CConnection* conn = static_cast<CConnection*>(&aContext.Node()); |
|
374 ConnActivities::CConnLegacyRMessage2Activity* act = static_cast<ConnActivities::CConnLegacyRMessage2Activity*>(aContext.Activity()); |
|
375 if (aError == KErrNotFound) |
|
376 { |
|
377 TPckgBuf<TStateChange> progressBuf; |
|
378 progressBuf().iStage = conn->iLastProgressError.iStage; |
|
379 progressBuf().iError = conn->iLastProgressError.iError; |
|
380 conn->ResetLastProgressError(); |
|
381 |
|
382 TRAPD(err, act->iSafeMessage.WriteL(0, progressBuf)); |
|
383 return err; |
|
384 } |
|
385 |
|
386 return aError; |
|
387 } |
|
388 |
|
389 /** |
|
390 * |
|
391 * TCprRequestServiceNotification |
|
392 * |
|
393 */ |
|
394 TBool TCprRequestServiceNotification::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
395 { |
|
396 return HasInterface(aContext, MLinkCprServiceChangeNotificationApiExt::KInterfaceId); |
|
397 } |
|
398 |
|
399 void TCprRequestServiceNotification::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
400 { |
|
401 ForwardRequestL(aContext); |
|
402 } |
|
403 |
|
404 void TCprRequestServiceNotification::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
405 { |
|
406 TAny* interface = FetchInterfaceL(aContext.Node(), MLinkCprServiceChangeNotificationApiExt::KInterfaceId); |
|
407 ASSERT(interface); |
|
408 |
|
409 MLinkCprServiceChangeNotificationApiExt& linkCprItf = *static_cast<MLinkCprServiceChangeNotificationApiExt*>(interface); |
|
410 RLegacyResponseMsg response(aContext, iMessage, iMessage.Int0()); |
|
411 linkCprItf.RequestServiceChangeNotificationL(iSender, response); |
|
412 } |
|
413 |
|
414 void TCprRequestServiceNotification::Cancel(MeshMachine::TNodeContextBase& aContext) |
|
415 { |
|
416 TAny* interface = FetchInterfaceL(aContext.Node(), MLinkCprServiceChangeNotificationApiExt::KInterfaceId); |
|
417 ASSERT(interface); |
|
418 |
|
419 MLinkCprServiceChangeNotificationApiExt& linkCprItf = *static_cast<MLinkCprServiceChangeNotificationApiExt*>(interface); |
|
420 linkCprItf.CancelServiceChangeNotification(iSender); |
|
421 } |
|
422 |
|
423 /** |
|
424 * |
|
425 * TCprSendIoctl |
|
426 * |
|
427 */ |
|
428 TBool TCprSendIoctl::CanProcess(MeshMachine::TNodeContextBase& /*aContext*/) |
|
429 { |
|
430 return EFalse; // always forward. If a node is going to process, it will do regardless of this |
|
431 } |
|
432 |
|
433 void TCprSendIoctl::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
434 { |
|
435 ForwardRequestL(aContext); |
|
436 } |
|
437 |
|
438 void TCprSendIoctl::ProcessL(MeshMachine::TNodeContextBase& /*aContext*/) |
|
439 { |
|
440 // do nothing, the nodes that receive the ioctl will handle it themselves |
|
441 ASSERT(0); |
|
442 } |
|
443 |
|
444 void TCprSendIoctl::Cancel(MeshMachine::TNodeContextBase& /*aContext*/) |
|
445 { |
|
446 // cancellation is handled by the node handling the ioctl, this should never be called |
|
447 ASSERT(0); |
|
448 } |
|
449 |
|
450 /** |
|
451 * |
|
452 * TCprFactEnumerateConnections |
|
453 * |
|
454 */ |
|
455 TBool TCprFactEnumerateConnections::CanProcess(MeshMachine::TNodeContextBase& /*aContext*/) |
|
456 { |
|
457 return ETrue; |
|
458 } |
|
459 |
|
460 void TCprFactEnumerateConnections::ForwardL(MeshMachine::TNodeContextBase& /*aContext*/) |
|
461 { |
|
462 ASSERT(0); // should never forward |
|
463 } |
|
464 |
|
465 void TCprFactEnumerateConnections::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
466 { |
|
467 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
468 const TNodeId& nodeId = address_cast<const TNodeId>(aContext.NodeId()); //This message type operates on nodes |
|
469 ASSERT(nodeId == SockManGlobals::Get()->GetPlaneFC(TCFPlayerRole(TCFPlayerRole::EConnPlane))); |
|
470 TAny* interface = NULL; |
|
471 TInt count = 0; |
|
472 |
|
473 TRAP_IGNORE(interface = FetchInterfaceL(nodeId.Node(), MLinkCprFactApiExt::KInterfaceId)); |
|
474 if (interface) |
|
475 { |
|
476 MLinkCprFactApiExt* cenumapi = reinterpret_cast<MLinkCprFactApiExt*>(interface); |
|
477 cenumapi->EnumerateConnectionsL(*iConnectionInfoPtrArray); |
|
478 count = iConnectionInfoPtrArray->Count(); |
|
479 } |
|
480 |
|
481 responseMsg.WriteL(0, TPckg<TUint>(count)); |
|
482 __CFLOG_VAR((KShimCprTag, KShimCprSubTag, _L8("TCprFactEnumerateConnections %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
483 this, iMessage.Handle())); |
|
484 |
|
485 responseMsg.Complete(KErrNone); |
|
486 } |
|
487 |
|
488 /** |
|
489 * TCprAllSubConnectionNotificationEnable |
|
490 * This is the only legacy self dispatcher left. |
|
491 */ |
|
492 void TCprAllSubConnectionNotificationEnable::DispatchL(const TRuntimeCtxId& aSender, const TRuntimeCtxId& aRecipient) |
|
493 { |
|
494 const TNodeId& nodeId = address_cast<const TNodeId>(aRecipient); //This message type operates on nodes |
|
495 TAny* interface = FetchInterfaceOrForwardMsgL(aSender, *this, nodeId.Node(), MLinkCprApiExt::KInterfaceId); |
|
496 |
|
497 if (interface) |
|
498 { |
|
499 MLinkCprApiExt& linkCprItf = *static_cast<MLinkCprApiExt*>(interface); |
|
500 linkCprItf.AllSubConnectionNotificationEnable(); |
|
501 } |
|
502 } |
|
503 |
|
504 void TCprAllSubConnectionNotificationEnable::Error(const TRuntimeCtxId& /*aSender*/, const TRuntimeCtxId& /*aRecipient*/, TInt /*aError*/) |
|
505 { |
|
506 ASSERT(EFalse);//should never get there. if so than we need to derive from TCFSigRMessage2Ext |
|
507 //to add RMessage and complete with error |
|
508 } |
|
509 |
|
510 |
|
511 void CLegacyDataMonitoringResponder::DoCancelRequest() |
|
512 { |
|
513 iLegacyResponseMsg.Complete(KErrCancel); |
|
514 } |
|
515 |
|
516 void CLegacyDataMonitoringResponder::DoDataTransferred(TUint32 aReceivedBytes, TUint32 aSentBytes) |
|
517 { |
|
518 TPckg<TUint> uplinkDataVolumePckg(aSentBytes); |
|
519 TPckg<TUint> downlinkDataVolumePckg(aReceivedBytes); |
|
520 |
|
521 TInt err = iLegacyResponseMsg.Write(1, uplinkDataVolumePckg); |
|
522 if(err != KErrNone) |
|
523 { |
|
524 iLegacyResponseMsg.Complete(err); |
|
525 return; |
|
526 } |
|
527 |
|
528 err = iLegacyResponseMsg.Write(2, downlinkDataVolumePckg); |
|
529 if(err != KErrNone) |
|
530 { |
|
531 iLegacyResponseMsg.Complete(err); |
|
532 return; |
|
533 } |
|
534 |
|
535 iLegacyResponseMsg.Complete(KErrNone); |
|
536 } |
|
537 |
|
538 void CLegacyDataMonitoringResponder::DoDataSentNotification(TUint32 aSentBytes) |
|
539 { |
|
540 TPckg<TUint> sentBytesPckg(aSentBytes); |
|
541 |
|
542 TInt err = iLegacyResponseMsg.Write(2, sentBytesPckg); |
|
543 if(err != KErrNone) |
|
544 { |
|
545 iLegacyResponseMsg.Complete(err); |
|
546 return; |
|
547 } |
|
548 |
|
549 iLegacyResponseMsg.Complete(KErrNone); |
|
550 } |
|
551 |
|
552 void CLegacyDataMonitoringResponder::DoDataReceivedNotification(TUint32 aReceivedBytes) |
|
553 { |
|
554 TPckg<TUint> receivedBytesPckg(aReceivedBytes); |
|
555 |
|
556 TInt err = iLegacyResponseMsg.Write(2, receivedBytesPckg); |
|
557 if(err != KErrNone) |
|
558 { |
|
559 iLegacyResponseMsg.Complete(err); |
|
560 return; |
|
561 } |
|
562 |
|
563 iLegacyResponseMsg.Complete(KErrNone); |
|
564 } |
|
565 |
|
566 EXPORT_C CLegacyDataMonitoringResponder* CLegacyDataMonitoringResponder::NewL(ESock::RLegacyResponseMsg& aResponseMsg) |
|
567 { |
|
568 return new(ELeave) CLegacyDataMonitoringResponder(aResponseMsg); |
|
569 } |
|
570 |
|
571 CLegacyDataMonitoringResponder::CLegacyDataMonitoringResponder(ESock::RLegacyResponseMsg& aResponseMsg) |
|
572 : CDataMonitoringResponder(aResponseMsg), iLegacyResponseMsg(aResponseMsg) |
|
573 { |
|
574 } |
|
575 |
|
576 /** |
|
577 * |
|
578 * TLegacyDataMonitoringTransferredRequest |
|
579 * |
|
580 */ |
|
581 TBool TLegacyDataMonitoringTransferredRequest::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
582 { |
|
583 return HasInterface(aContext, EDataMonitoringApiExt); |
|
584 } |
|
585 |
|
586 void TLegacyDataMonitoringTransferredRequest::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
587 { |
|
588 // If we're at the connection, we must decide which plane to go down |
|
589 if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler) |
|
590 { |
|
591 TInt subConnUniqueId = iMessage.Int0(); |
|
592 CConnection& connection = static_cast<CConnection&>(aContext.Node()); |
|
593 |
|
594 switch(subConnUniqueId) |
|
595 { |
|
596 case KNifEMCompatibilityLayerEntireSubConnectionUid: |
|
597 if(!connection.ServiceProvider()) |
|
598 { |
|
599 User::Leave(KErrNotReady); |
|
600 } |
|
601 else |
|
602 { |
|
603 aContext.Activity()->PostRequestTo(*connection.ServiceProvider(), *this); |
|
604 } |
|
605 break; |
|
606 |
|
607 case KNifEMCompatibilityLayerFakeSubConnectionId: |
|
608 if(!connection.DefaultSubConnectionServiceProvider()) |
|
609 { |
|
610 User::Leave(KErrNotReady); |
|
611 } |
|
612 else |
|
613 { |
|
614 aContext.Activity()->PostRequestTo(*connection.DefaultSubConnectionServiceProvider(), *this); |
|
615 } |
|
616 break; |
|
617 |
|
618 default: |
|
619 LOG(ESockLog::Printf(KESockConnectionTag, |
|
620 _L8("CConnectionLegacy(%08x)::DataMonitoringNotificationRequestL - client return set to %d. Bad subconnection id. (%d) specified."), |
|
621 &connection, KErrArgument, subConnUniqueId)); |
|
622 |
|
623 User::Leave(KErrArgument); |
|
624 return; |
|
625 } |
|
626 } |
|
627 else |
|
628 { |
|
629 ForwardRequestL(aContext); |
|
630 } |
|
631 } |
|
632 |
|
633 void TLegacyDataMonitoringTransferredRequest::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
634 { |
|
635 TAny* interface = FetchInterfaceL(aContext.Node(), EDataMonitoringApiExt); |
|
636 ASSERT(interface); |
|
637 |
|
638 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
639 CDataMonitoringResponder* responder = CLegacyDataMonitoringResponder::NewL(responseMsg); |
|
640 ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface); |
|
641 dataMonItf.RequestDataTransferred(responder, iClientId); |
|
642 } |
|
643 |
|
644 void TLegacyDataMonitoringTransferredRequest::Cancel(MeshMachine::TNodeContextBase& /*aContext*/) |
|
645 { |
|
646 // do nothing, a DataMonitoringTransferedRequest cannot be cancelled as the response is immediate |
|
647 } |
|
648 |
|
649 TInt TLegacyDataMonitoringTransferredRequest::CheckError(MeshMachine::TNodeContextBase& /*aContext*/, TInt aError) |
|
650 { |
|
651 if (aError == KErrNotFound) |
|
652 { |
|
653 return KErrNotReady; |
|
654 } |
|
655 return aError; |
|
656 } |
|
657 |
|
658 /** |
|
659 Return ETrue if the node has a Service Provider, else EFalse. |
|
660 |
|
661 Code copied from TCFItfExt::ForwardMessageLTCFItfExt::ForwardMessageL(). |
|
662 */ |
|
663 TBool TLegacyDataMonitoringTransferredRequest::HasServiceProviderL(const Messages::TRuntimeCtxId& aRecipient) |
|
664 { |
|
665 ANode& node = address_cast<const TNodeId>(aRecipient).Node(); //This message type operates on nodes |
|
666 NetInterfaces::TInterfaceControl* ic = node.FetchNodeInterfaceControlL(AMMNodeBase::KInterfaceId); |
|
667 MeshMachine::AMMNodeBase* nodeBase = reinterpret_cast<MeshMachine::AMMNodeBase*>(ic->FetchInterfaceL(AMMNodeBase::KInterfaceId)); |
|
668 return (nodeBase->GetFirstClient<TDefaultClientMatchPolicy>(TClientType(TCFClientType::EServProvider)) != NULL); |
|
669 } |
|
670 |
|
671 /** |
|
672 * |
|
673 * TLegacyDataMonitoringNotificationRequest |
|
674 * |
|
675 */ |
|
676 TBool TLegacyDataMonitoringNotificationRequest::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
677 { |
|
678 return HasInterface(aContext, EDataMonitoringApiExt); |
|
679 } |
|
680 |
|
681 void TLegacyDataMonitoringNotificationRequest::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
682 { |
|
683 // If we're at the connection, we must decide which plane to go down |
|
684 if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler) |
|
685 { |
|
686 TInt subConnUniqueId = iMessage.Int0(); |
|
687 CConnection& connection = static_cast<CConnection&>(aContext.Node()); |
|
688 |
|
689 switch(subConnUniqueId) |
|
690 { |
|
691 case KNifEMCompatibilityLayerEntireSubConnectionUid: |
|
692 if(!connection.ServiceProvider()) |
|
693 { |
|
694 User::Leave(KErrNotReady); |
|
695 } |
|
696 else |
|
697 { |
|
698 aContext.Activity()->PostRequestTo(*connection.ServiceProvider(), *this); |
|
699 } |
|
700 break; |
|
701 |
|
702 case KNifEMCompatibilityLayerFakeSubConnectionId: |
|
703 if(!connection.DefaultSubConnectionServiceProvider()) |
|
704 { |
|
705 User::Leave(KErrNotReady); |
|
706 } |
|
707 else |
|
708 { |
|
709 aContext.Activity()->PostRequestTo(*connection.DefaultSubConnectionServiceProvider(), *this); |
|
710 } |
|
711 break; |
|
712 |
|
713 default: |
|
714 LOG(ESockLog::Printf(KESockConnectionTag, |
|
715 _L8("CConnectionLegacy(%08x)::DataMonitoringNotificationRequestL - client return set to %d. Bad subconnection id. (%d) specified."), |
|
716 &connection, KErrArgument, subConnUniqueId)); |
|
717 |
|
718 User::Leave(KErrArgument); |
|
719 return; |
|
720 } |
|
721 } |
|
722 else |
|
723 { |
|
724 ForwardRequestL(aContext); |
|
725 } |
|
726 } |
|
727 |
|
728 void TLegacyDataMonitoringNotificationRequest::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
729 { |
|
730 TAny* interface = FetchInterfaceL(aContext.Node(), EDataMonitoringApiExt); |
|
731 ASSERT(interface); |
|
732 |
|
733 // Pluck out the parameters from the IPC message |
|
734 TUint delta = static_cast<TUint>(iMessage.Int1()); |
|
735 TUint volume = 0; |
|
736 TPckg<TUint> volumeBuf(volume); |
|
737 iMessage.ReadL(2, volumeBuf); |
|
738 |
|
739 // Create a ResponseMsg and responder for completing the client |
|
740 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
741 CDataMonitoringResponder* responder = CLegacyDataMonitoringResponder::NewL(responseMsg); |
|
742 |
|
743 ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface); |
|
744 switch(iDirection) |
|
745 { |
|
746 case ESent: |
|
747 dataMonItf.RequestDataSentNotification(responder, delta, volume, iClientId); |
|
748 break; |
|
749 |
|
750 case EReceived: |
|
751 dataMonItf.RequestDataReceivedNotification(responder, delta, volume, iClientId); |
|
752 break; |
|
753 default: |
|
754 delete responder; |
|
755 } |
|
756 // coverity [leaked_storage] - responder is owned by dataMonItf.RequestDataSentNotification, dataMonItf.RequestDataReceivedNotification |
|
757 // therefore we don't need to push them onto the cleanup stack. |
|
758 } |
|
759 |
|
760 void TLegacyDataMonitoringNotificationRequest::Cancel(MeshMachine::TNodeContextBase& aContext) |
|
761 { |
|
762 TAny* interface = FetchInterfaceL(aContext.Node(), EDataMonitoringApiExt); |
|
763 ASSERT(interface); |
|
764 |
|
765 if (interface) |
|
766 { |
|
767 ADataMonitoringProtocolReq& dataMonItf = *static_cast<ADataMonitoringProtocolReq*>(interface); |
|
768 |
|
769 switch(iDirection) |
|
770 { |
|
771 case ESent: |
|
772 dataMonItf.CancelDataSentNotificationRequest(iClientId); |
|
773 break; |
|
774 |
|
775 case EReceived: |
|
776 dataMonItf.CancelDataReceivedNotificationRequest(iClientId); |
|
777 break; |
|
778 } |
|
779 } |
|
780 } |
|
781 |
|
782 TInt TLegacyDataMonitoringNotificationRequest::CheckError(MeshMachine::TNodeContextBase& /*aContext*/, TInt aError) |
|
783 { |
|
784 return aError; |
|
785 } |
|
786 |
|
787 /** |
|
788 * |
|
789 * TLegacyEnumerateSubConnections |
|
790 * |
|
791 */ |
|
792 TBool TLegacyEnumerateSubConnections::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
793 { |
|
794 return HasInterface(aContext, ELegacyEnumerateSubConnectionsApiExt); |
|
795 } |
|
796 |
|
797 void TLegacyEnumerateSubConnections::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
798 { |
|
799 ForwardRequestL(aContext); |
|
800 } |
|
801 |
|
802 void TLegacyEnumerateSubConnections::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
803 { |
|
804 TAny* interface = FetchInterfaceL(aContext.Node(), ELegacyEnumerateSubConnectionsApiExt); |
|
805 ASSERT(interface); |
|
806 |
|
807 // Create a ResponseMsg and responder for completing the client |
|
808 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
809 CLegacyEnumerateSubConnectionsResponder* responder = CLegacyEnumerateSubConnectionsResponder::NewL(responseMsg); |
|
810 |
|
811 ALegacyEnumerateSubConnectionsApiExt& itf = *static_cast<ALegacyEnumerateSubConnectionsApiExt*>(interface); |
|
812 itf.EnumerateSubConnections(responder); |
|
813 } |
|
814 |
|
815 |
|
816 CLegacyEnumerateSubConnectionsResponder* CLegacyEnumerateSubConnectionsResponder::NewL(RLegacyResponseMsg& aResponseMsg) |
|
817 { |
|
818 return new(ELeave) CLegacyEnumerateSubConnectionsResponder(aResponseMsg); |
|
819 } |
|
820 |
|
821 EXPORT_C void CLegacyEnumerateSubConnectionsResponder::CompleteClient(CLegacyEnumerateSubConnectionsResponder*& aThis, TInt aCount) |
|
822 { |
|
823 if (aThis==NULL) |
|
824 return; |
|
825 |
|
826 TPckg<TUint> countPckg(aCount); |
|
827 TInt err = aThis->iResponseMsg.Write(0, countPckg); |
|
828 aThis->iResponseMsg.Complete(err); |
|
829 |
|
830 delete aThis; |
|
831 aThis = NULL; |
|
832 } |
|
833 |
|
834 /** |
|
835 * |
|
836 * TLegacyControlMessage |
|
837 * |
|
838 */ |
|
839 TBool TLegacyControlMessage::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
840 { |
|
841 return HasInterface(aContext, MLegacyControlApiExt::KInterfaceId); |
|
842 } |
|
843 |
|
844 void TLegacyControlMessage::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
845 { |
|
846 ForwardRequestL(aContext); |
|
847 } |
|
848 |
|
849 void TLegacyControlMessage::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
850 { |
|
851 TAny* interface = FetchInterfaceL(aContext.Node(), MLegacyControlApiExt::KInterfaceId); |
|
852 ASSERT(interface); |
|
853 |
|
854 MLegacyControlApiExt& controlItf = *static_cast<MLegacyControlApiExt*>(interface); |
|
855 |
|
856 TInt length = iMessage.GetDesLengthL(2); |
|
857 RBuf8 option; |
|
858 option.CreateL(length); |
|
859 CleanupClosePushL(option); |
|
860 iMessage.ReadL(2, option); |
|
861 |
|
862 TUint optionLevel = static_cast<TUint>(iMessage.Int0()); |
|
863 TUint optionName = static_cast<TUint>(iMessage.Int1()); |
|
864 |
|
865 TInt ret = controlItf.ControlL(optionLevel, optionName, option, this); |
|
866 if (ret == KErrNone) |
|
867 { |
|
868 // write options buffer back to client if required |
|
869 if (optionName & KConnWriteUserDataBit) |
|
870 { |
|
871 iMessage.WriteL(2, option); |
|
872 } |
|
873 } |
|
874 |
|
875 CleanupStack::PopAndDestroy(); // option |
|
876 |
|
877 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
878 |
|
879 switch (ret) |
|
880 { |
|
881 case KErrNone: |
|
882 __CFLOG_VAR((KESockComponentTag, KCFNodeTag, _L8("TLegacyControlMessage %08x:\tDispatchL() completing message (%08X) with KErrNone"), |
|
883 this, iMessage.Handle())); |
|
884 responseMsg.Complete(KErrNone); |
|
885 return; |
|
886 |
|
887 case KErrNotSupported: |
|
888 // The option level/name wasn't supported on this node |
|
889 // Continue forwarding down until we find an interface that does support |
|
890 // it or we hit the bottom |
|
891 TRAP(ret, ForwardRequestL(aContext)); |
|
892 |
|
893 if(ret == KErrNotFound) |
|
894 { |
|
895 // We've reached the bottom of the stack and control call was never serviced |
|
896 User::Leave(KErrNotSupported); |
|
897 } |
|
898 break; |
|
899 |
|
900 default: |
|
901 __CFLOG_VAR((KESockComponentTag, KCFNodeTag, _L8("TLegacyControlMessage %08x:\tDispatchL() completing message (%08X) with %d"), |
|
902 this, iMessage.Handle(), ret)); |
|
903 responseMsg.Complete(ret); |
|
904 break; |
|
905 } |
|
906 } |
|
907 |
|
908 /** |
|
909 * |
|
910 * TLegacyConnectionEnumRequest |
|
911 * |
|
912 */ |
|
913 TLegacyConnectionEnumRequest::TLegacyConnectionEnumRequest(RArray<TNodeId>& aSCPRCandidates, TLegacyConnEnumClients aClientType) |
|
914 : iSCPRCandidates(&aSCPRCandidates), |
|
915 iClientType(aClientType) |
|
916 { |
|
917 } |
|
918 |
|
919 void TLegacyConnectionEnumRequest::DispatchL(const TRuntimeCtxId& aSender, const TRuntimeCtxId& /*aRecipient*/) |
|
920 { |
|
921 CSockManData* globs = SockManGlobals::Get(); |
|
922 CPlayer* player = globs->SelfPlayer(); |
|
923 ASSERT(player->HasDataPlane()); |
|
924 CPlayer::TSubSessionContainer subSessions(player->SubSessions()); |
|
925 |
|
926 // Memory handling "cheat"; alloc the max possible req here and shrink later. Avoids need to |
|
927 // keep reallocing & handling errors, and in practice this is a rare function and the overshoot |
|
928 // won't be bad (not so many sockets usually, and reallocing more liable to fragmentation) |
|
929 const TInt entrySize = (iClientType == ESocket)? sizeof(TConnectionSocketInfo): sizeof(TConnectionClientInfo); |
|
930 HBufC8* resBuf = HBufC8::NewL(entrySize * subSessions.Count()); |
|
931 TPtr8 resDes(resBuf->Des()); |
|
932 TInt entries = 0; |
|
933 |
|
934 TNodeId flow; |
|
935 TNodeId scpr; |
|
936 TUidType uidType; |
|
937 |
|
938 for(TInt i = subSessions.Count() - 1; i >= 0; --i) |
|
939 { |
|
940 const CSockSubSession* ss = static_cast<const CSockSubSession*>(subSessions[i]); |
|
941 if(ss->Type().iType == TCFSubSessInfo::ESocket) |
|
942 { |
|
943 const CSocket* sock = static_cast<const CSocket*>(ss); |
|
944 if(!sock->GetFlowAndSCPR(flow, scpr)) |
|
945 { |
|
946 ss = NULL; |
|
947 } |
|
948 } |
|
949 else if(iClientType == EAll && ss->Type().iType == TCFSubSessInfo::EHostResolver) |
|
950 { |
|
951 const CHostResolver* hr = static_cast<const CHostResolver*>(ss); |
|
952 if(!hr->GetFlowAndSCPR(flow, scpr)) |
|
953 { |
|
954 ss = NULL; |
|
955 } |
|
956 } |
|
957 else |
|
958 { |
|
959 ss = NULL; |
|
960 } |
|
961 |
|
962 if(ss != NULL && iSCPRCandidates->Find(scpr) >= 0) |
|
963 { |
|
964 if(iClientType == ESocket) |
|
965 { |
|
966 // Enumerating sockets |
|
967 TConnectionSocketInfo info; |
|
968 if(static_cast<const CSocket*>(ss)->GetConnectionSocketInfo(info) == KErrNone) |
|
969 { |
|
970 resDes.Append(reinterpret_cast<TUint8*>(&info), sizeof(info)); |
|
971 ++entries; |
|
972 } |
|
973 } |
|
974 else |
|
975 { |
|
976 // Enumerating clients |
|
977 TConnectionClientInfo info; |
|
978 ss->GetOwnerInfo(info.iProcessId, uidType, info.iThreadId); |
|
979 info.iUid = uidType.MostDerived(); |
|
980 if (!AConnectionLegacy::DoesConnectionInfoExist(resDes, info)) |
|
981 { |
|
982 resDes.Append(reinterpret_cast<TUint8*>(&info), sizeof(info)); |
|
983 ++entries; |
|
984 } |
|
985 } |
|
986 } |
|
987 } |
|
988 if(entries < subSessions.Count()) |
|
989 { |
|
990 resBuf = resBuf->ReAlloc(resDes.Length()); |
|
991 ASSERT(resBuf); // realloc is shrinking buffer so this is allocator misbehaviour |
|
992 } |
|
993 TNodeId selfId(globs->iSubConnectionFlowFactories->Id()); |
|
994 TCFInternalEsock::TLegacyConnectionEnumResponse resp(entries, reinterpret_cast<TInt>(resBuf), KErrNone); |
|
995 RClientInterface::OpenPostMessageClose(selfId, aSender, resp); |
|
996 } |
|
997 |
|
998 |
|
999 void TLegacyConnectionEnumRequest::Error(const TRuntimeCtxId& aSender, const TRuntimeCtxId& /*aRecipient*/, TInt aError) |
|
1000 { |
|
1001 TCFInternalEsock::TLegacyConnectionEnumResponse resp(0, NULL, aError); |
|
1002 RClientInterface::OpenPostMessageClose(TNodeId(), aSender, resp); //TODO[PROD] - is this TNodeId() correct???? |
|
1003 } |
|
1004 |
|
1005 |
|
1006 /** |
|
1007 * |
|
1008 * TLegacySubConnectionActiveRequest |
|
1009 * |
|
1010 */ |
|
1011 TBool TLegacySubConnectionActiveRequest::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
1012 { |
|
1013 return HasInterface(aContext, ELegacySubConnectionActiveApiExt); |
|
1014 } |
|
1015 |
|
1016 void TLegacySubConnectionActiveRequest::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
1017 { |
|
1018 // If we're at the connection, we must decide which plane to go down |
|
1019 if (aContext.Activity()->ActivitySigId() == ECFActivityConnectionLegacyRMessage2Handler) |
|
1020 { |
|
1021 TInt subConnUniqueId = iMessage.Int0(); |
|
1022 CConnection& connection = static_cast<CConnection&>(aContext.Node()); |
|
1023 |
|
1024 switch(subConnUniqueId) |
|
1025 { |
|
1026 case KNifEMCompatibilityLayerEntireSubConnectionUid: |
|
1027 if(!connection.ServiceProvider()) |
|
1028 { |
|
1029 User::Leave(KErrNotReady); |
|
1030 } |
|
1031 else |
|
1032 { |
|
1033 aContext.Activity()->PostRequestTo(*connection.ServiceProvider(), *this); |
|
1034 } |
|
1035 break; |
|
1036 |
|
1037 case KNifEMCompatibilityLayerFakeSubConnectionId: |
|
1038 if(!connection.DefaultSubConnectionServiceProvider()) |
|
1039 { |
|
1040 User::Leave(KErrNotReady); |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 aContext.Activity()->PostRequestTo(*connection.DefaultSubConnectionServiceProvider(), *this); |
|
1045 } |
|
1046 break; |
|
1047 |
|
1048 default: |
|
1049 LOG(ESockLog::Printf(KESockConnectionTag, |
|
1050 _L8("TLegacySubConnectionActive(%08x)::ForwardL - client return set to %d. Bad subconnection id. (%d) specified."), |
|
1051 &connection, KErrArgument, subConnUniqueId)); |
|
1052 |
|
1053 User::Leave(KErrArgument); |
|
1054 return; |
|
1055 } |
|
1056 } |
|
1057 else |
|
1058 { |
|
1059 ForwardRequestL(aContext); |
|
1060 } |
|
1061 } |
|
1062 |
|
1063 void TLegacySubConnectionActiveRequest::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
1064 { |
|
1065 TAny* interface = FetchInterfaceL(aContext.Node(), ELegacySubConnectionActiveApiExt); |
|
1066 ASSERT(interface); |
|
1067 |
|
1068 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
1069 CLegacySubConnectionActiveResponder* responder = CLegacySubConnectionActiveResponder::NewL(responseMsg, iMessage.Int1(), iClientId); |
|
1070 |
|
1071 ALegacySubConnectionActiveApiExt& subConnActiveItf = *static_cast<ALegacySubConnectionActiveApiExt*>(interface); |
|
1072 subConnActiveItf.IsSubConnectionActiveRequest(*responder); |
|
1073 } |
|
1074 |
|
1075 void TLegacySubConnectionActiveRequest::Cancel(MeshMachine::TNodeContextBase& aContext) |
|
1076 { |
|
1077 TAny* interface = FetchInterfaceL(aContext.Node(), ELegacySubConnectionActiveApiExt); |
|
1078 ASSERT(interface); |
|
1079 |
|
1080 ALegacySubConnectionActiveApiExt& subConnActiveItf = *static_cast<ALegacySubConnectionActiveApiExt*>(interface); |
|
1081 subConnActiveItf.CancelIsSubConnectionActiveRequest(iClientId); |
|
1082 } |
|
1083 |
|
1084 CLegacySubConnectionActiveResponder* CLegacySubConnectionActiveResponder::NewL(ESock::RLegacyResponseMsg& aResponseMsg, TUint aTimerPeriod, TUint aClientId) |
|
1085 { |
|
1086 CLegacySubConnectionActiveResponder* self = new(ELeave) CLegacySubConnectionActiveResponder(aResponseMsg, aTimerPeriod, aClientId); |
|
1087 CleanupStack::PushL(self); |
|
1088 |
|
1089 if (self->iTimerPeriod > KMaxTimerPeriod) // secs; underlying CTimer limitation |
|
1090 { |
|
1091 User::Leave(KErrArgument); |
|
1092 } |
|
1093 |
|
1094 TPckg<TBool> stateBuf(self->iClientPerceivedState); |
|
1095 aResponseMsg.ReadL(2, stateBuf); |
|
1096 |
|
1097 CleanupStack::Pop(self); |
|
1098 return self; |
|
1099 } |
|
1100 |
|
1101 void CLegacySubConnectionActiveResponder::SubConnectionActive(TBool aState) |
|
1102 { |
|
1103 TPckg<TBool> subConnectionActiveBuf(aState); |
|
1104 TInt err = iResponseMsg.Write(2, subConnectionActiveBuf); |
|
1105 Complete(err); |
|
1106 } |
|
1107 |
|
1108 void CLegacySubConnectionActiveResponder::Error(TInt aError) |
|
1109 { |
|
1110 Complete(aError); |
|
1111 } |
|
1112 |
|
1113 void CLegacySubConnectionActiveResponder::Complete(TInt aError) |
|
1114 { |
|
1115 DoComplete(aError); |
|
1116 |
|
1117 delete this; |
|
1118 } |
|
1119 |
|
1120 /** |
|
1121 * |
|
1122 * TLegacyGetSubConnectionInfo |
|
1123 * |
|
1124 */ |
|
1125 TBool TLegacyGetSubConnectionInfo::CanProcess(MeshMachine::TNodeContextBase& aContext) |
|
1126 { |
|
1127 return HasInterface(aContext, ELegacyEnumerateSubConnectionsApiExt); |
|
1128 } |
|
1129 |
|
1130 void TLegacyGetSubConnectionInfo::ForwardL(MeshMachine::TNodeContextBase& aContext) |
|
1131 { |
|
1132 ForwardRequestL(aContext); |
|
1133 } |
|
1134 |
|
1135 void TLegacyGetSubConnectionInfo::ProcessL(MeshMachine::TNodeContextBase& aContext) |
|
1136 { |
|
1137 TAny* interface = FetchInterfaceL(aContext.Node(), ELegacyEnumerateSubConnectionsApiExt); |
|
1138 ASSERT(interface); |
|
1139 |
|
1140 RLegacyResponseMsg responseMsg(aContext, iMessage, iMessage.Int0()); |
|
1141 ALegacyEnumerateSubConnectionsApiExt& subConnItf = *static_cast<ALegacyEnumerateSubConnectionsApiExt*>(interface); |
|
1142 |
|
1143 subConnItf.GetSubConnectionInfo(iSubConnectionInfo); |
|
1144 |
|
1145 TPckg<TSubConnectionInfo> pckg(iSubConnectionInfo); |
|
1146 responseMsg.Write(1, pckg); |
|
1147 responseMsg.Complete(KErrNone); |
|
1148 } |
|
1149 |
|
1150 /** |
|
1151 * |
|
1152 * Attribute Tables |
|
1153 * |
|
1154 */ |
|
1155 START_ATTRIBUTE_TABLE(TCprRetrieveProgress, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprRetrieveProgress) |
|
1156 REGISTER_ATTRIBUTE(TCprRetrieveProgress, iLastProgress, TMeta<TStateChange>) |
|
1157 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1158 |
|
1159 START_ATTRIBUTE_TABLE(TCprRetrieveLastProgressError, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprRetrieveLastProgressError) |
|
1160 REGISTER_ATTRIBUTE(TCprRetrieveLastProgressError, iLastProgressError, TMeta<TStateChange>) |
|
1161 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1162 |
|
1163 START_ATTRIBUTE_TABLE(TCprRequestServiceNotification, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprRequestServiceNotification) |
|
1164 REGISTER_ATTRIBUTE(TCprRequestServiceNotification, iSender, TMeta<Messages::TNodeId>) |
|
1165 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1166 |
|
1167 START_ATTRIBUTE_TABLE(TCprSendIoctl, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprSendIoctl) |
|
1168 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1169 |
|
1170 START_ATTRIBUTE_TABLE(TCprAllSubConnectionNotificationEnable, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprAllSubConnectionNotificationEnable) |
|
1171 END_ATTRIBUTE_TABLE_BASE(TSignalBase, 0) |
|
1172 |
|
1173 START_ATTRIBUTE_TABLE(TCprFactEnumerateConnections, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ECprEnumerateConnections) |
|
1174 REGISTER_ATTRIBUTE(TCprFactEnumerateConnections, iConnectionInfoPtrArray, TMeta<RPointerArray<TConnectionInfo>*>) |
|
1175 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1176 |
|
1177 EXPORT_START_ATTRIBUTE_TABLE_AND_FN( TCFSigLegacyRMessage2Ext, TCFSigLegacyRMessage2Ext::EUid, TCFSigLegacyRMessage2Ext::ETypeId ) //has to be derived from |
|
1178 REGISTER_ATTRIBUTE( TCFSigLegacyRMessage2Ext, iMessage, TMeta<RReadOnlyRMessage> ) |
|
1179 END_ATTRIBUTE_TABLE_BASE(Messages::TSignatureBase, 0) |
|
1180 |
|
1181 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TMCprGetConnectionSetting, TCFLegacyMessage::ERealmId, TMCprGetConnectionSetting::EId) |
|
1182 REGISTER_ATTRIBUTE(TMCprGetConnectionSetting, iSettingType, TMeta<TConnectionSettingType>) |
|
1183 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1184 |
|
1185 EXPORT_START_ATTRIBUTE_TABLE_AND_FN( TSigLegacyRMessage2Response, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ESignatureRMessage2Response ) |
|
1186 REGISTER_ATTRIBUTE( TSigLegacyRMessage2Response, iResponse, TMeta<TLegacyRMessage2Response> ) |
|
1187 END_ATTRIBUTE_TABLE_BASE( Messages::TSignatureBase, ESignatureBase ) |
|
1188 |
|
1189 EXPORT_START_ATTRIBUTE_TABLE_AND_FN(TGetOrSetParameters, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::EGetOrSetParameters) |
|
1190 REGISTER_ATTRIBUTE(TGetOrSetParameters, iDataObject, TMeta<XCommsDataObject**>) |
|
1191 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1192 |
|
1193 START_ATTRIBUTE_TABLE(TLegacyDataMonitoringTransferredRequest, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyDataMonitoringTransferredRequest) |
|
1194 REGISTER_ATTRIBUTE(TLegacyDataMonitoringTransferredRequest, iClientId, TMeta<TSubSessionUniqueId>) |
|
1195 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1196 |
|
1197 START_ATTRIBUTE_TABLE(TLegacyDataMonitoringNotificationRequest, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyDataMonitoringNotificationRequest) |
|
1198 REGISTER_ATTRIBUTE(TLegacyDataMonitoringNotificationRequest, iDirection, TMeta<TDataMonitoringDirection>) |
|
1199 REGISTER_ATTRIBUTE(TLegacyDataMonitoringNotificationRequest, iClientId, TMeta<TSubSessionUniqueId>) |
|
1200 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1201 |
|
1202 START_ATTRIBUTE_TABLE(TLegacyEnumerateSubConnections, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyEnumerateSubConnections) |
|
1203 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1204 |
|
1205 START_ATTRIBUTE_TABLE(TLegacyControlMessage, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyControlMessage) |
|
1206 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1207 |
|
1208 START_ATTRIBUTE_TABLE(TLegacyConnectionEnumRequest, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyConnEnumMessage) |
|
1209 REGISTER_ATTRIBUTE( TLegacyConnectionEnumRequest, iSCPRCandidates, TMeta<TAny*> ) |
|
1210 REGISTER_ATTRIBUTE( TLegacyConnectionEnumRequest, iClientType, TMetaNumber ) |
|
1211 END_ATTRIBUTE_TABLE_BASE(TSignalBase, 0) |
|
1212 |
|
1213 START_ATTRIBUTE_TABLE(TLegacySubConnectionActiveRequest, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacySubConnectionActiveRequest) |
|
1214 REGISTER_ATTRIBUTE(TLegacySubConnectionActiveRequest, iClientId, TMeta<TSubSessionUniqueId>) |
|
1215 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1216 |
|
1217 START_ATTRIBUTE_TABLE(TLegacyGetSubConnectionInfo, TCFLegacyMessage::ERealmId, TCFLegacyMessageInternal::ELegacyGetSubConnectionInfo) |
|
1218 REGISTER_ATTRIBUTE(TLegacyGetSubConnectionInfo, iSubConnectionInfo, TMeta<TSubConnectionInfo>) |
|
1219 END_ATTRIBUTE_TABLE_BASE(TCFSigLegacyRMessage2Ext, 0) |
|
1220 |
|
1221 /** |
|
1222 * Constuctors |
|
1223 */ |
|
1224 DEFINE_MVIP_CTR(TSigLegacyRMessage2Response); |
|
1225 DEFINE_MVIP_CTR(TGetOrSetParameters); |
|
1226 DEFINE_MVIP_CTR(TMCprGetConnectionSetting); |
|
1227 DEFINE_MVIP_CTR(TCprRetrieveProgress); |
|
1228 DEFINE_MVIP_CTR(TCprRetrieveLastProgressError); |
|
1229 DEFINE_MVIP_CTR(TCprRequestServiceNotification); |
|
1230 DEFINE_MVIP_CTR(TCprSendIoctl); |
|
1231 DEFINE_MVIP_CTR(TCprAllSubConnectionNotificationEnable); |
|
1232 DEFINE_MVIP_CTR(TCprFactEnumerateConnections); |
|
1233 DEFINE_MVIP_CTR(TLegacyDataMonitoringTransferredRequest); |
|
1234 DEFINE_MVIP_CTR(TLegacyDataMonitoringNotificationRequest); |
|
1235 DEFINE_MVIP_CTR(TLegacyEnumerateSubConnections); |
|
1236 DEFINE_MVIP_CTR(TLegacyControlMessage); |
|
1237 DEFINE_MVIP_CTR(TLegacyConnectionEnumRequest); |
|
1238 DEFINE_MVIP_CTR(TLegacySubConnectionActiveRequest); |
|
1239 DEFINE_MVIP_CTR(TLegacyGetSubConnectionInfo); |
|
1240 |
|
1241 const TImplementationProxy SignatureImplementationTable[] = |
|
1242 { |
|
1243 |
|
1244 |
|
1245 MVIP_CTR_ENTRY(TMCprGetConnectionSetting::EId, TMCprGetConnectionSetting), //101 |
|
1246 |
|
1247 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::EGetOrSetParameters,TGetOrSetParameters), //200 |
|
1248 |
|
1249 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprRetrieveProgress,TCprRetrieveProgress), //201 |
|
1250 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprRetrieveLastProgressError,TCprRetrieveLastProgressError), //202 |
|
1251 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprRequestServiceNotification,TCprRequestServiceNotification), //203 |
|
1252 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprSendIoctl,TCprSendIoctl), //204 |
|
1253 |
|
1254 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprAllSubConnectionNotificationEnable,TCprAllSubConnectionNotificationEnable), //205 |
|
1255 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ECprEnumerateConnections,TCprFactEnumerateConnections), //206 |
|
1256 |
|
1257 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyDataMonitoringTransferredRequest, TLegacyDataMonitoringTransferredRequest), //207 |
|
1258 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyDataMonitoringNotificationRequest, TLegacyDataMonitoringNotificationRequest), //208 |
|
1259 |
|
1260 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacySubConnectionActiveRequest, TLegacySubConnectionActiveRequest), //209 |
|
1261 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyEnumerateSubConnections, TLegacyEnumerateSubConnections), //210 |
|
1262 |
|
1263 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyControlMessage, TLegacyControlMessage), //211 |
|
1264 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyConnEnumMessage, TLegacyConnectionEnumRequest), //212 |
|
1265 |
|
1266 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ESignatureRMessage2Response, TSigLegacyRMessage2Response), //213 |
|
1267 |
|
1268 MVIP_CTR_ENTRY(TCFLegacyMessageInternal::ELegacyGetSubConnectionInfo, TLegacyGetSubConnectionInfo), //214 |
|
1269 }; |
|
1270 |
|
1271 void TCFLegacyMessage::RegisterL() |
|
1272 { |
|
1273 TlsGlobals::Get().RegisterInterfaceL(TUid::Uid(TCFLegacyMessage::ERealmId), sizeof(SignatureImplementationTable) / sizeof(SignatureImplementationTable[0]), SignatureImplementationTable); |
|
1274 } |
|
1275 |
|
1276 void TCFLegacyMessage::DeRegister() |
|
1277 { |
|
1278 TlsGlobals::Get().DeregisterInterface(TUid::Uid(TCFLegacyMessage::ERealmId)); |
|
1279 } |
|
1280 |
|
1281 |