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