|
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 // This is part of an ECOM plug-in |
|
15 // |
|
16 // |
|
17 |
|
18 #define SYMBIAN_NETWORKING_UPS |
|
19 |
|
20 #include <comms-infras/ss_log.h> |
|
21 #include <comms-infras/ss_corepractivities.h> |
|
22 #include <comms-infras/coretiermanagerstates.h> |
|
23 #include <comms-infras/coretiermanageractivities.h> |
|
24 #include "iptiermanager.h" |
|
25 #include "iptiermanagerselector.h" |
|
26 |
|
27 #ifdef SYMBIAN_NETWORKING_UPS |
|
28 #include "iptiermanagerfactory.h" // CIpTierManagerFactory::iUid |
|
29 #include <comms-infras/netups.h> |
|
30 #include <comms-infras/netupsserviceid.h> |
|
31 using namespace NetUps; |
|
32 #endif |
|
33 |
|
34 #ifdef SYMBIAN_TRACE_ENABLE |
|
35 #define KIpTierMgrTag KESockMetaConnectionTag |
|
36 // _LIT8(KIpTierMgrSubTag, "iptiermgr"); |
|
37 #endif |
|
38 |
|
39 using namespace Messages; |
|
40 using namespace MeshMachine; |
|
41 using namespace ESock; |
|
42 using namespace NetStateMachine; |
|
43 |
|
44 namespace IpTierManagerActivities |
|
45 { |
|
46 DECLARE_DEFINE_ACTIVITY_MAP(stateMap) |
|
47 ACTIVITY_MAP_END_BASE(TMActivities, coreTMActivities) |
|
48 } |
|
49 |
|
50 |
|
51 CIpTierManager* CIpTierManager::NewL(ESock::CTierManagerFactoryBase& aFactory) |
|
52 /** Factory function for the factory which manages ip level meta connection providers. |
|
53 This function also acts as the single ECom entry point into this object. |
|
54 @param aParentContainer the parent factory container which owns this factory |
|
55 @return factory for IP level meta connection providers |
|
56 */ |
|
57 { |
|
58 #ifdef SYMBIAN_NETWORKING_UPS |
|
59 CIpTierManager* self = new (ELeave) CIpTierManager(aFactory, IpTierManagerActivities::stateMap::Self()); |
|
60 CleanupStack::PushL(self); |
|
61 self->OpenNetUpsL(); |
|
62 CleanupStack::Pop(self); |
|
63 return self; |
|
64 #else |
|
65 return new (ELeave) CIpTierManager(aFactory, IpTierManagerActivities::stateMap::Self()); |
|
66 #endif |
|
67 } |
|
68 |
|
69 CIpTierManager::CIpTierManager(ESock::CTierManagerFactoryBase& aFactory, |
|
70 const MeshMachine::TNodeActivityMap& aActivityMap) |
|
71 : CCoreTierManager(aFactory,aActivityMap) |
|
72 /** Constructor for ip level meta connection providers. |
|
73 @param aFactoryId the ID which this factory can be looked up by |
|
74 @param aParentContainer the parent factory container which owns this factory |
|
75 */ |
|
76 { |
|
77 LOG_NODE_CREATE(KIpTierMgrTag, CIpTierManager); |
|
78 } |
|
79 |
|
80 CIpTierManager::~CIpTierManager() |
|
81 { |
|
82 #ifdef SYMBIAN_NETWORKING_UPS |
|
83 CloseNetUps(); |
|
84 #endif |
|
85 |
|
86 LOG_NODE_DESTROY(KIpTierMgrTag, CIpTierManager); |
|
87 } |
|
88 |
|
89 MProviderSelector* CIpTierManager::DoCreateProviderSelectorL(const Meta::SMetaData& aSelectionPreferences) |
|
90 { |
|
91 //Decide which selector to create based on the information available. |
|
92 return TIpProviderSelectorFactory::NewSelectorL(aSelectionPreferences); |
|
93 } |
|
94 |
|
95 void CIpTierManager::ReceivedL(const TRuntimeCtxId& aSender, const TNodeId& aRecipient, TSignatureBase& aMessage) |
|
96 { |
|
97 TNodeContext<CIpTierManager> ctx(*this, aMessage, aSender, aRecipient); |
|
98 CCoreTierManager::Received(ctx); |
|
99 User::LeaveIfError(ctx.iReturn); |
|
100 } |
|
101 |
|
102 #ifdef SYMBIAN_NETWORKING_UPS |
|
103 |
|
104 void CIpTierManager::OpenNetUpsL() |
|
105 { |
|
106 // @TODO PREQ1116 - temporary hack, this needs to be allocated from a DLL that will retain the |
|
107 // NetUps instance until ESock terminates. |
|
108 ASSERT(iNetUps == NULL); |
|
109 TRAP_IGNORE(iNetUps = NetUps::CNetUps::NewL(NetUps::EIpServiceId)); |
|
110 } |
|
111 |
|
112 void CIpTierManager::CloseNetUps() |
|
113 { |
|
114 if (iNetUps) |
|
115 { |
|
116 delete iNetUps; |
|
117 iNetUps = NULL; |
|
118 } |
|
119 } |
|
120 |
|
121 #endif |