2154 |
2154 |
2155 // --------------------------------------------------------------------------- |
2155 // --------------------------------------------------------------------------- |
2156 // |
2156 // |
2157 // --------------------------------------------------------------------------- |
2157 // --------------------------------------------------------------------------- |
2158 // |
2158 // |
2159 TBool WlanDot11Associated::AddMulticastAddr( |
|
2160 WlanContextImpl& aCtxImpl, |
|
2161 const TMacAddress& aMacAddr ) |
|
2162 { |
|
2163 TBool stateTransitionOccurred( EFalse ); |
|
2164 |
|
2165 OsTracePrint( |
|
2166 KWlmCmdDetails, |
|
2167 (TUint8*) |
|
2168 ("UMAC: WlanDot11Associated::AddMulticastAddr(): addr to be added:"), |
|
2169 aMacAddr); |
|
2170 |
|
2171 if ( aCtxImpl.MulticastFilteringDisAllowed() ) |
|
2172 { |
|
2173 OsTracePrint( |
|
2174 KWlmCmdDetails, |
|
2175 (TUint8*) |
|
2176 ("UMAC: WlanDot11Associated::AddMulticastAddr(): Multicast filtering disallowed")); |
|
2177 |
|
2178 OnOidComplete( aCtxImpl, KErrGeneral ); |
|
2179 } |
|
2180 else |
|
2181 { |
|
2182 if ( aCtxImpl.WHASettings().iNumOfGroupTableEntrys > |
|
2183 aCtxImpl.MulticastAddressCount() ) |
|
2184 { |
|
2185 // wha layer is able to take in an address |
|
2186 |
|
2187 // 1st try to add the address to our own internal bookkeeping |
|
2188 WlanContextImpl::TGroupAddStatus addStatus = |
|
2189 aCtxImpl.AddMulticastAddress( aMacAddr ); |
|
2190 |
|
2191 switch ( addStatus ) |
|
2192 { |
|
2193 case WlanContextImpl::EOk: |
|
2194 OsTracePrint( |
|
2195 KWlmCmdDetails, |
|
2196 (TUint8*) |
|
2197 ("UMAC: WlanDot11Associated::AddMulticastAddr(): Address will be added to the MIB")); |
|
2198 // the address needed to be added and adding went ok. |
|
2199 // Now update the group addresses MIB |
|
2200 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
2201 break; |
|
2202 case WlanContextImpl::EAlreadyExists: |
|
2203 OsTracePrint( |
|
2204 KWlmCmdDetails, |
|
2205 (TUint8*) |
|
2206 ("UMAC: WlanDot11Associated::AddMulticastAddr(): Address already exists")); |
|
2207 // the specified address already exists so there's no need |
|
2208 // to update the group addresses MIB |
|
2209 // just complete the request with OK status |
|
2210 OnOidComplete( aCtxImpl ); |
|
2211 stateTransitionOccurred = EFalse; |
|
2212 break; |
|
2213 case WlanContextImpl::EFull: |
|
2214 OsTracePrint( |
|
2215 KWlmCmdDetails, |
|
2216 (TUint8*) |
|
2217 ("UMAC: WlanDot11Associated::AddMulticastAddr(): Internal address table full; disallow multicast filtering")); |
|
2218 // we are not able to take in any more addresses. |
|
2219 // We will totally disable the multicast filtering |
|
2220 // and we won't allow it to be enabled any more during |
|
2221 // the current nw connection |
|
2222 // |
|
2223 aCtxImpl.ResetMulticastAddresses(); |
|
2224 aCtxImpl.MulticastFilteringDisAllowed( ETrue ); |
|
2225 stateTransitionOccurred = |
|
2226 SetGroupAddressesTableMib( aCtxImpl ); |
|
2227 break; |
|
2228 default: |
|
2229 // programming error |
|
2230 OsTracePrint( KErrorLevel, (TUint8*) |
|
2231 ("UMAC: addStatus: %d"), addStatus ); |
|
2232 OsAssert( (TUint8*)("UMAC: panic"), |
|
2233 (TUint8*)(WLAN_FILE), __LINE__ ); |
|
2234 } |
|
2235 } |
|
2236 else |
|
2237 { |
|
2238 OsTracePrint( |
|
2239 KWlmCmdDetails, |
|
2240 (TUint8*) |
|
2241 ("UMAC: WlanDot11Associated::AddMulticastAddr(): WHA not able to accept address; disallow multicast filtering")); |
|
2242 // wha layer is not able to take in an address. Either this is one |
|
2243 // address too many, or it doesn't support even a single address. |
|
2244 // In either case we will totally disable the multicast filtering |
|
2245 // and we won't allow it to be enabled any more during the current |
|
2246 // nw connection |
|
2247 aCtxImpl.ResetMulticastAddresses(); |
|
2248 aCtxImpl.MulticastFilteringDisAllowed( ETrue ); |
|
2249 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
2250 } |
|
2251 } |
|
2252 |
|
2253 // signal caller whether a state transition occurred or not |
|
2254 return stateTransitionOccurred; |
|
2255 } |
|
2256 |
|
2257 // --------------------------------------------------------------------------- |
|
2258 // |
|
2259 // --------------------------------------------------------------------------- |
|
2260 // |
|
2261 TBool WlanDot11Associated::RemoveMulticastAddr( |
|
2262 WlanContextImpl& aCtxImpl, |
|
2263 TBool aRemoveAll, |
|
2264 const TMacAddress& aMacAddr ) |
|
2265 { |
|
2266 TBool stateTransitionOccurred( EFalse ); |
|
2267 |
|
2268 OsTracePrint( |
|
2269 KWlmCmdDetails, |
|
2270 (TUint8*) |
|
2271 ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): addr to be removed:"), |
|
2272 aMacAddr); |
|
2273 |
|
2274 if ( aCtxImpl.MulticastFilteringDisAllowed() ) |
|
2275 { |
|
2276 OsTracePrint( |
|
2277 KWlmCmdDetails, |
|
2278 (TUint8*) |
|
2279 ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): Multicast filtering disallowed")); |
|
2280 // filtering is not allowed currently so there can't be any addresses |
|
2281 // to remove. Just complete the request with OK status |
|
2282 OnOidComplete( aCtxImpl ); |
|
2283 } |
|
2284 else |
|
2285 { |
|
2286 if ( aRemoveAll ) |
|
2287 { |
|
2288 OsTracePrint( |
|
2289 KWlmCmdDetails, |
|
2290 (TUint8*) |
|
2291 ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): remove all")); |
|
2292 // remove all addresses; naturally will also disable filtering |
|
2293 aCtxImpl.ResetMulticastAddresses(); |
|
2294 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
2295 } |
|
2296 else |
|
2297 { |
|
2298 // 1st remove the specified address from our own internal |
|
2299 // bookkeeping, if it exists |
|
2300 if ( aCtxImpl.RemoveMulticastAddress( aMacAddr ) ) |
|
2301 { |
|
2302 OsTracePrint( |
|
2303 KWlmCmdDetails, |
|
2304 (TUint8*) |
|
2305 ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): removing the specified address")); |
|
2306 // it existed, so update the group addresses MIB, too |
|
2307 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
2308 } |
|
2309 else |
|
2310 { |
|
2311 OsTracePrint( |
|
2312 KWlmCmdDetails, |
|
2313 (TUint8*) |
|
2314 ("UMAC: WlanDot11Associated::RemoveMulticastAddr(): specified address doesn't exist, nothing to do")); |
|
2315 // it did't exist, so there's nothing to remove |
|
2316 // Just complete the request with OK status |
|
2317 OnOidComplete( aCtxImpl ); |
|
2318 } |
|
2319 } |
|
2320 } |
|
2321 |
|
2322 // signal caller whether a state transition occurred or not |
|
2323 return stateTransitionOccurred; |
|
2324 } |
|
2325 |
|
2326 // --------------------------------------------------------------------------- |
|
2327 // |
|
2328 // --------------------------------------------------------------------------- |
|
2329 // |
|
2330 TBool WlanDot11Associated::AddBroadcastWepKey( |
2159 TBool WlanDot11Associated::AddBroadcastWepKey( |
2331 WlanContextImpl& aCtxImpl, |
2160 WlanContextImpl& aCtxImpl, |
2332 TUint32 aKeyIndex, |
2161 TUint32 aKeyIndex, |
2333 TBool aUseAsDefaulKey, |
2162 TBool aUseAsDefaulKey, |
2334 TUint32 aKeyLength, |
2163 TUint32 aKeyLength, |
2392 |
2221 |
2393 // --------------------------------------------------------------------------- |
2222 // --------------------------------------------------------------------------- |
2394 // |
2223 // |
2395 // --------------------------------------------------------------------------- |
2224 // --------------------------------------------------------------------------- |
2396 // |
2225 // |
2397 TBool WlanDot11Associated::SetGroupAddressesTableMib( |
|
2398 WlanContextImpl& aCtxImpl ) |
|
2399 { |
|
2400 const TMacAddress* multicastAddresses( NULL ); |
|
2401 const TUint32 nbrOfAddrs( |
|
2402 aCtxImpl.GetMulticastAddresses( multicastAddresses ) ); |
|
2403 |
|
2404 TUint32 mibLength( |
|
2405 // mib header length |
|
2406 WHA::Sdot11GroupAddressesTable::KHeaderSize |
|
2407 // + mib data length |
|
2408 + ( sizeof( TMacAddress ) * nbrOfAddrs ) ); |
|
2409 |
|
2410 // align length of MIB to 4-byte boundary |
|
2411 mibLength = Align4( mibLength ); |
|
2412 |
|
2413 OsTracePrint( |
|
2414 KWlmCmdDetails, |
|
2415 (TUint8*) |
|
2416 ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): mibLength: %d"), |
|
2417 mibLength ); |
|
2418 |
|
2419 // allocate memory for the mib to write |
|
2420 WHA::Sdot11GroupAddressesTable* mib |
|
2421 = static_cast<WHA::Sdot11GroupAddressesTable*> |
|
2422 (os_alloc( mibLength )); |
|
2423 |
|
2424 if ( !mib ) |
|
2425 { |
|
2426 // allocation failed |
|
2427 // simulate macnotresponding error |
|
2428 OsTracePrint( KWarningLevel, (TUint8*) |
|
2429 ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): memory allocating failed") ); |
|
2430 return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); |
|
2431 } |
|
2432 |
|
2433 if ( nbrOfAddrs ) |
|
2434 { |
|
2435 // at least one address exists, so enable multicast address filtering |
|
2436 mib->iEnable = ETrue; |
|
2437 } |
|
2438 else |
|
2439 { |
|
2440 // no addresses, so disable filtering |
|
2441 mib->iEnable = EFalse; |
|
2442 OsTracePrint( KWlmCmdDetails, (TUint8*) |
|
2443 ("UMAC: WlanDot11Associated::SetGroupAddressesTableMib(): no addresses; disable filtering") ); |
|
2444 } |
|
2445 |
|
2446 mib->iNumOfAddrs = nbrOfAddrs; |
|
2447 |
|
2448 // copy the multicast addresses after the mib header |
|
2449 os_memcpy( mib->iAddrData, |
|
2450 reinterpret_cast<TUint8*>(const_cast<TMacAddress*>( |
|
2451 multicastAddresses)), |
|
2452 ( sizeof( TMacAddress ) * nbrOfAddrs ) ); |
|
2453 |
|
2454 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
2455 |
|
2456 wha_cmd.Set( |
|
2457 aCtxImpl, |
|
2458 WHA::KMibDot11GroupAddressesTable, |
|
2459 mibLength, |
|
2460 mib ); |
|
2461 |
|
2462 // change global state: entry procedure triggers action |
|
2463 ChangeState( aCtxImpl, |
|
2464 *this, // prev state |
|
2465 wha_cmd, // next state |
|
2466 // the ACT |
|
2467 KCompleteManagementRequest |
|
2468 ); |
|
2469 |
|
2470 os_free( mib ); // release the allocated memory |
|
2471 |
|
2472 // signal caller that a state transition occurred |
|
2473 return ETrue; |
|
2474 } |
|
2475 |
|
2476 // --------------------------------------------------------------------------- |
|
2477 // |
|
2478 // --------------------------------------------------------------------------- |
|
2479 // |
|
2480 TBool WlanDot11Associated::PowerMgmtModeChange( |
2226 TBool WlanDot11Associated::PowerMgmtModeChange( |
2481 WlanContextImpl& aCtxImpl, |
2227 WlanContextImpl& aCtxImpl, |
2482 TPowerMgmtModeChange aPowerMgmtModeChange ) |
2228 TPowerMgmtModeChange aPowerMgmtModeChange ) |
2483 { |
2229 { |
2484 TBool stateChange ( EFalse ); |
2230 TBool stateChange ( EFalse ); |