|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements Network Config Extension for HotSpot |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
20 #include <nifman_internal.h> |
|
21 #endif |
|
22 #include "NetCfgExtnHotSpot.h" |
|
23 #include "implementationproxy.h" |
|
24 #include "am_debug.h" |
|
25 |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // NewL |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 CNetworkConfigExtensionHotSpot* CNetworkConfigExtensionHotSpot::NewL( |
|
34 TAny* aMNifIfNotify ) |
|
35 { |
|
36 MNifIfNotify* nifIfNotify = reinterpret_cast<MNifIfNotify*>( aMNifIfNotify ); |
|
37 CNetworkConfigExtensionHotSpot* pDaemon = |
|
38 new( ELeave )CNetworkConfigExtensionHotSpot( *nifIfNotify ); |
|
39 CleanupStack::PushL( pDaemon ); |
|
40 pDaemon->ConstructL(); |
|
41 CleanupStack::Pop( pDaemon ); |
|
42 return pDaemon; |
|
43 } |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // ConstructL |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 void CNetworkConfigExtensionHotSpot::ConstructL() |
|
50 { |
|
51 DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL()" ); |
|
52 CNetworkConfigExtensionBase::ConstructL(); |
|
53 iNotAuthenticated = ETrue; |
|
54 iNotDeregistered = ETrue; |
|
55 iHotspotConnect = KErrNotFound; |
|
56 DEBUG( "CNetworkConfigExtensionHotSpot::ConstructL() Done" ); |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // SendIoctlMessageL |
|
61 // Forwards Ioctl request to the daemon and activates the AO to wait for response |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 void CNetworkConfigExtensionHotSpot::SendIoctlMessageL( const ESock::RLegacyResponseMsg& aMessage ) |
|
65 |
|
66 { |
|
67 TInt name = aMessage.Int1(); |
|
68 if ( aMessage.Int0() != KCOLConfiguration ) |
|
69 { |
|
70 User::Leave( KErrNotSupported ); |
|
71 } |
|
72 else |
|
73 { |
|
74 switch ( name ) |
|
75 { |
|
76 case KConnAddrRelease: |
|
77 case KConnAddrRenew: |
|
78 case KConnSetDhcpRawOptionData: |
|
79 if ( aMessage.HasCapability(ECapabilityNetworkControl, "NetCfgExtnDhcp" ) == EFalse ) |
|
80 { |
|
81 User::Leave (KErrPermissionDenied ); |
|
82 } |
|
83 } |
|
84 } |
|
85 CNetworkConfigExtensionBase::SendIoctlMessageL( aMessage ); |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // ~CNetworkConfigExtensionHotSpot |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot() |
|
93 |
|
94 { |
|
95 DEBUG( "CNetworkConfigExtensionHotSpot::~CNetworkConfigExtensionHotSpot()" ); |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // ImplementationTable |
|
100 // ----------------------------------------------------------------------------- |
|
101 // |
|
102 const TImplementationProxy ImplementationTable[] = |
|
103 { |
|
104 IMPLEMENTATION_PROXY_ENTRY(0x10282ECA, CNetworkConfigExtensionHotSpot::NewL) |
|
105 }; |
|
106 |
|
107 // ----------------------------------------------------------------------------- |
|
108 // ImplementationGroupProxy |
|
109 // ----------------------------------------------------------------------------- |
|
110 // |
|
111 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
112 { |
|
113 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
114 |
|
115 return ImplementationTable; |
|
116 } |
|
117 |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // RunL |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 void CNetworkConfigExtensionHotSpot::RunL() |
|
124 { |
|
125 DEBUG( "CNetworkConfigExtensionHotSpot::RunL()" ); |
|
126 if (iLastGenericProgressStage == KConfigDaemonStartingRegistration) |
|
127 { |
|
128 |
|
129 if(iNotAuthenticated) |
|
130 { |
|
131 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() not auth" ); |
|
132 TUint iapId = iConnectionInfoBuf().iIapId; |
|
133 TUint networkId = iConnectionInfoBuf().iNetId; |
|
134 |
|
135 iHotspotConnect = iClient.Connect(); |
|
136 |
|
137 if ( KErrNone == iHotspotConnect ) |
|
138 { |
|
139 iClient.StartLogin( iapId, networkId, iStatus); |
|
140 SetActive(); |
|
141 } |
|
142 else |
|
143 { |
|
144 CNetworkConfigExtensionBase::RunL(); |
|
145 } |
|
146 iNotAuthenticated = EFalse; |
|
147 } |
|
148 else |
|
149 { |
|
150 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() close" ); |
|
151 CNetworkConfigExtensionBase::RunL(); |
|
152 } |
|
153 |
|
154 } |
|
155 else if (iLastGenericProgressStage == KConfigDaemonStartingDeregistration) |
|
156 { |
|
157 if(iNotDeregistered) |
|
158 { |
|
159 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg" ); |
|
160 TUint iapId = iConnectionInfoBuf().iIapId; |
|
161 TUint networkId = iConnectionInfoBuf().iNetId; |
|
162 |
|
163 if ( KErrNone == iHotspotConnect ) |
|
164 { |
|
165 iClient.CloseConnection( iapId, iStatus); |
|
166 SetActive(); |
|
167 } |
|
168 else |
|
169 { |
|
170 CNetworkConfigExtensionBase::RunL(); |
|
171 } |
|
172 iNotDeregistered = EFalse; |
|
173 } |
|
174 else |
|
175 { |
|
176 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() dereg close" ); |
|
177 iClient.Close(); |
|
178 CNetworkConfigExtensionBase::RunL(); |
|
179 } |
|
180 } |
|
181 else // original ========================================================= |
|
182 { |
|
183 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() original" ); |
|
184 CNetworkConfigExtensionBase::RunL(); |
|
185 } |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // DoCancel |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 void CNetworkConfigExtensionHotSpot::DoCancel() |
|
193 { |
|
194 DEBUG( "CNetworkConfigExtensionHotSpot::RunL() DoCancel" ); |
|
195 iClient.CancelLogin(); |
|
196 } |
|
197 |
|
198 // end of file |
|
199 |