|
1 // Copyright (c) 2006-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 // IP Connection Provider implementation |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #define SYMBIAN_NETWORKING_UPS |
|
24 |
|
25 #include <comms-infras/corecprstates.h> |
|
26 #include <comms-infras/corecpractivities.h> |
|
27 #include "IPCpr.h" |
|
28 #include "IPMessages.h" |
|
29 #include <comms-infras/ss_log.h> |
|
30 #include <comms-infras/api_ext_list.h> |
|
31 |
|
32 #include <comms-infras/ss_msgintercept.h> |
|
33 |
|
34 #ifdef SYMBIAN_TRACE_ENABLE |
|
35 #define KIPCprTag KESockConnectionTag |
|
36 // _LIT8(KIPCprSubTag, "ipcpr"); |
|
37 #endif // SYMBIAN_TRACE_ENABLE |
|
38 |
|
39 using namespace Messages; |
|
40 using namespace ESock; |
|
41 using namespace NetStateMachine; |
|
42 using namespace MeshMachine; |
|
43 |
|
44 //We reserve space for two preallocated activities that may start concurrently on the CPR |
|
45 //node: destroy and data client stop. |
|
46 static const TUint KDefaultMaxPreallocatedActivityCount = 2; |
|
47 static const TUint KMaxPreallocatedActivitySize = sizeof(MeshMachine::CNodeRetryParallelActivity) + sizeof(MeshMachine::APreallocatedOriginators<4>); |
|
48 static const TUint KIPCPRPreallocatedActivityBufferSize = KDefaultMaxPreallocatedActivityCount * KMaxPreallocatedActivitySize; |
|
49 |
|
50 //-========================================================= |
|
51 // |
|
52 // CIPConnectionProvider methods |
|
53 // |
|
54 //-========================================================= |
|
55 CIPConnectionProvider* CIPConnectionProvider::NewL(ESock::CConnectionProviderFactoryBase& aFactory) |
|
56 { |
|
57 CIPConnectionProvider* provider = new (ELeave) CIPConnectionProvider(aFactory); |
|
58 CleanupStack::PushL(provider); |
|
59 provider->ConstructL(KIPCPRPreallocatedActivityBufferSize); |
|
60 CleanupStack::Pop(provider); |
|
61 return provider; |
|
62 } |
|
63 |
|
64 CIPConnectionProvider::CIPConnectionProvider(ESock::CConnectionProviderFactoryBase& aFactory) |
|
65 : CMobilityConnectionProvider(aFactory, IpCprActivities::ipCprActivities::Self()) |
|
66 { |
|
67 LOG_NODE_CREATE(KIPCprTag, CIPConnectionProvider); |
|
68 } |
|
69 |
|
70 CIPConnectionProvider::~CIPConnectionProvider() |
|
71 { |
|
72 LOG_NODE_DESTROY(KIPCprTag, CIPConnectionProvider); |
|
73 } |
|
74 |
|
75 void CIPConnectionProvider::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) |
|
76 { |
|
77 TNodeContext<CIPConnectionProvider> ctx(*this, aMessage, aSender, aRecipient); |
|
78 ESOCK_DEBUG_MESSAGE_INTERCEPT(aSender, aMessage, aRecipient); |
|
79 CMobilityConnectionProvider::ReceivedL(aSender, aRecipient, aMessage); |
|
80 User::LeaveIfError(ctx.iReturn); |
|
81 } |
|
82 |
|
83 |
|
84 #ifdef SYMBIAN_NETWORKING_UPS |
|
85 RNodeInterface* CIPConnectionProvider::NewClientInterfaceL(const TClientType& aClientType, TAny* aClientInfo) |
|
86 { |
|
87 |
|
88 if (aClientType.Type() & TCFClientType::ECtrl) |
|
89 { |
|
90 if (aClientInfo == NULL) |
|
91 { // This is not CPR, probably CConnection, use min priority. |
|
92 return new (ELeave) RIPCprControlClientNodeInterface(KMaxTUint); |
|
93 } |
|
94 else |
|
95 { |
|
96 const TUint* priority = static_cast<const TUint*>(aClientInfo); |
|
97 return new (ELeave) RIPCprControlClientNodeInterface(*priority); |
|
98 } |
|
99 } |
|
100 |
|
101 return CConnectionProviderBase::NewClientInterfaceL(aClientType, aClientInfo); |
|
102 } |
|
103 #endif |
|
104 |