3056 } |
3056 } |
3057 |
3057 |
3058 return ret; |
3058 return ret; |
3059 } |
3059 } |
3060 |
3060 |
|
3061 // --------------------------------------------------------------------------- |
|
3062 // |
|
3063 // --------------------------------------------------------------------------- |
|
3064 // |
|
3065 TBool WlanDot11State::AddMulticastAddr( |
|
3066 WlanContextImpl& aCtxImpl, |
|
3067 const TMacAddress& aMacAddr ) |
|
3068 { |
|
3069 TBool stateTransitionOccurred( EFalse ); |
|
3070 |
|
3071 OsTracePrint( |
|
3072 KWlmCmdDetails, |
|
3073 (TUint8*) |
|
3074 ("UMAC: WlanDot11State::AddMulticastAddr(): addr to be added:"), |
|
3075 aMacAddr); |
|
3076 |
|
3077 if ( aCtxImpl.MulticastFilteringDisAllowed() ) |
|
3078 { |
|
3079 OsTracePrint( |
|
3080 KWlmCmdDetails, |
|
3081 (TUint8*) |
|
3082 ("UMAC: WlanDot11State::AddMulticastAddr(): Multicast filtering " |
|
3083 "disallowed")); |
|
3084 |
|
3085 OnOidComplete( aCtxImpl, KErrGeneral ); |
|
3086 } |
|
3087 else |
|
3088 { |
|
3089 if ( aCtxImpl.WHASettings().iNumOfGroupTableEntrys > |
|
3090 aCtxImpl.MulticastAddressCount() ) |
|
3091 { |
|
3092 // wha layer is able to take in an address |
|
3093 |
|
3094 // 1st try to add the address to our own internal bookkeeping |
|
3095 WlanContextImpl::TGroupAddStatus addStatus = |
|
3096 aCtxImpl.AddMulticastAddress( aMacAddr ); |
|
3097 |
|
3098 switch ( addStatus ) |
|
3099 { |
|
3100 case WlanContextImpl::EOk: |
|
3101 OsTracePrint( |
|
3102 KWlmCmdDetails, |
|
3103 (TUint8*) |
|
3104 ("UMAC: WlanDot11State::AddMulticastAddr(): Address " |
|
3105 "will be added to the MIB")); |
|
3106 // the address needed to be added and adding went ok. |
|
3107 // Now update the group addresses MIB |
|
3108 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
3109 break; |
|
3110 case WlanContextImpl::EAlreadyExists: |
|
3111 OsTracePrint( |
|
3112 KWlmCmdDetails, |
|
3113 (TUint8*) |
|
3114 ("UMAC: WlanDot11State::AddMulticastAddr(): Address " |
|
3115 "already exists")); |
|
3116 // the specified address already exists so there's no need |
|
3117 // to update the group addresses MIB |
|
3118 // just complete the request with OK status |
|
3119 OnOidComplete( aCtxImpl ); |
|
3120 stateTransitionOccurred = EFalse; |
|
3121 break; |
|
3122 case WlanContextImpl::EFull: |
|
3123 OsTracePrint( |
|
3124 KWlmCmdDetails, |
|
3125 (TUint8*) |
|
3126 ("UMAC: WlanDot11State::AddMulticastAddr(): Internal " |
|
3127 "address table full; disallow multicast filtering")); |
|
3128 // we are not able to take in any more addresses. |
|
3129 // We will totally disable the multicast filtering |
|
3130 // and we won't allow it to be enabled any more during |
|
3131 // the current nw connection |
|
3132 // |
|
3133 aCtxImpl.ResetMulticastAddresses(); |
|
3134 aCtxImpl.MulticastFilteringDisAllowed( ETrue ); |
|
3135 stateTransitionOccurred = |
|
3136 SetGroupAddressesTableMib( aCtxImpl ); |
|
3137 break; |
|
3138 default: |
|
3139 // programming error |
|
3140 OsTracePrint( KErrorLevel, (TUint8*) |
|
3141 ("UMAC: addStatus: %d"), addStatus ); |
|
3142 OsAssert( (TUint8*)("UMAC: panic"), |
|
3143 (TUint8*)(WLAN_FILE), __LINE__ ); |
|
3144 } |
|
3145 } |
|
3146 else |
|
3147 { |
|
3148 OsTracePrint( |
|
3149 KWlmCmdDetails, |
|
3150 (TUint8*) |
|
3151 ("UMAC: WlanDot11State::AddMulticastAddr(): WHA not able to " |
|
3152 "accept address; disallow multicast filtering")); |
|
3153 // wha layer is not able to take in an address. Either this is one |
|
3154 // address too many, or it doesn't support even a single address. |
|
3155 // In either case we will totally disable the multicast filtering |
|
3156 // and we won't allow it to be enabled any more during the current |
|
3157 // nw connection |
|
3158 aCtxImpl.ResetMulticastAddresses(); |
|
3159 aCtxImpl.MulticastFilteringDisAllowed( ETrue ); |
|
3160 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
3161 } |
|
3162 } |
|
3163 |
|
3164 // signal caller whether a state transition occurred or not |
|
3165 return stateTransitionOccurred; |
|
3166 } |
|
3167 |
|
3168 // --------------------------------------------------------------------------- |
|
3169 // |
|
3170 // --------------------------------------------------------------------------- |
|
3171 // |
|
3172 TBool WlanDot11State::RemoveMulticastAddr( |
|
3173 WlanContextImpl& aCtxImpl, |
|
3174 TBool aRemoveAll, |
|
3175 const TMacAddress& aMacAddr ) |
|
3176 { |
|
3177 TBool stateTransitionOccurred( EFalse ); |
|
3178 |
|
3179 OsTracePrint( |
|
3180 KWlmCmdDetails, |
|
3181 (TUint8*) |
|
3182 ("UMAC: WlanDot11State::RemoveMulticastAddr(): addr to be removed:"), |
|
3183 aMacAddr); |
|
3184 |
|
3185 if ( aCtxImpl.MulticastFilteringDisAllowed() ) |
|
3186 { |
|
3187 OsTracePrint( |
|
3188 KWlmCmdDetails, |
|
3189 (TUint8*) |
|
3190 ("UMAC: WlanDot11State::RemoveMulticastAddr(): Multicast filtering " |
|
3191 "disallowed")); |
|
3192 // filtering is not allowed currently so there can't be any addresses |
|
3193 // to remove. Just complete the request with OK status |
|
3194 OnOidComplete( aCtxImpl ); |
|
3195 } |
|
3196 else |
|
3197 { |
|
3198 if ( aRemoveAll ) |
|
3199 { |
|
3200 OsTracePrint( |
|
3201 KWlmCmdDetails, |
|
3202 (TUint8*) |
|
3203 ("UMAC: WlanDot11State::RemoveMulticastAddr(): remove all")); |
|
3204 // remove all addresses; naturally will also disable filtering |
|
3205 aCtxImpl.ResetMulticastAddresses(); |
|
3206 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
3207 } |
|
3208 else |
|
3209 { |
|
3210 // 1st remove the specified address from our own internal |
|
3211 // bookkeeping, if it exists |
|
3212 if ( aCtxImpl.RemoveMulticastAddress( aMacAddr ) ) |
|
3213 { |
|
3214 OsTracePrint( |
|
3215 KWlmCmdDetails, |
|
3216 (TUint8*) |
|
3217 ("UMAC: WlanDot11State::RemoveMulticastAddr(): removing " |
|
3218 "the specified address")); |
|
3219 // it existed, so update the group addresses MIB, too |
|
3220 stateTransitionOccurred = SetGroupAddressesTableMib( aCtxImpl ); |
|
3221 } |
|
3222 else |
|
3223 { |
|
3224 OsTracePrint( |
|
3225 KWlmCmdDetails, |
|
3226 (TUint8*) |
|
3227 ("UMAC: WlanDot11State::RemoveMulticastAddr(): specified " |
|
3228 "address doesn't exist, nothing to do")); |
|
3229 // it did't exist, so there's nothing to remove |
|
3230 // Just complete the request with OK status |
|
3231 OnOidComplete( aCtxImpl ); |
|
3232 } |
|
3233 } |
|
3234 } |
|
3235 |
|
3236 // signal caller whether a state transition occurred or not |
|
3237 return stateTransitionOccurred; |
|
3238 } |
|
3239 |
3061 // ----------------------------------------------------------------------------- |
3240 // ----------------------------------------------------------------------------- |
3062 // |
3241 // |
3063 // ----------------------------------------------------------------------------- |
3242 // ----------------------------------------------------------------------------- |
3064 // |
3243 // |
3065 TBool WlanDot11State::InitNetworkConnect( |
3244 TBool WlanDot11State::InitNetworkConnect( |
4089 |
4268 |
4090 // signal caller that no state transition occurred |
4269 // signal caller that no state transition occurred |
4091 return EFalse; |
4270 return EFalse; |
4092 } |
4271 } |
4093 |
4272 |
|
4273 // --------------------------------------------------------------------------- |
|
4274 // |
|
4275 // --------------------------------------------------------------------------- |
|
4276 // |
|
4277 TBool WlanDot11State::SetGroupAddressesTableMib( |
|
4278 WlanContextImpl& aCtxImpl ) |
|
4279 { |
|
4280 const TMacAddress* multicastAddresses( NULL ); |
|
4281 const TUint32 nbrOfAddrs( |
|
4282 aCtxImpl.GetMulticastAddresses( multicastAddresses ) ); |
|
4283 |
|
4284 TUint32 mibLength( |
|
4285 // mib header length |
|
4286 WHA::Sdot11GroupAddressesTable::KHeaderSize |
|
4287 // + mib data length |
|
4288 + ( sizeof( TMacAddress ) * nbrOfAddrs ) ); |
|
4289 |
|
4290 // align length of MIB to 4-byte boundary |
|
4291 mibLength = Align4( mibLength ); |
|
4292 |
|
4293 OsTracePrint( |
|
4294 KWlmCmdDetails, |
|
4295 (TUint8*) |
|
4296 ("UMAC: WlanDot11State::SetGroupAddressesTableMib(): mibLength: %d"), |
|
4297 mibLength ); |
|
4298 |
|
4299 // allocate memory for the mib to write |
|
4300 WHA::Sdot11GroupAddressesTable* mib |
|
4301 = static_cast<WHA::Sdot11GroupAddressesTable*> |
|
4302 (os_alloc( mibLength )); |
|
4303 |
|
4304 if ( !mib ) |
|
4305 { |
|
4306 // allocation failed |
|
4307 // simulate macnotresponding error |
|
4308 OsTracePrint( KWarningLevel, (TUint8*) |
|
4309 ("UMAC: WlanDot11State::SetGroupAddressesTableMib(): memory " |
|
4310 "allocation failed") ); |
|
4311 return DoErrorIndication( aCtxImpl, WHA::KErrorMacNotResponding ); |
|
4312 } |
|
4313 |
|
4314 if ( nbrOfAddrs ) |
|
4315 { |
|
4316 // at least one address exists, so enable multicast address filtering |
|
4317 mib->iEnable = ETrue; |
|
4318 } |
|
4319 else |
|
4320 { |
|
4321 // no addresses, so disable filtering |
|
4322 mib->iEnable = EFalse; |
|
4323 OsTracePrint( KWlmCmdDetails, (TUint8*) |
|
4324 ("UMAC: WlanDot11State::SetGroupAddressesTableMib(): no addresses; " |
|
4325 "disable filtering") ); |
|
4326 } |
|
4327 |
|
4328 mib->iNumOfAddrs = nbrOfAddrs; |
|
4329 |
|
4330 // copy the multicast addresses after the mib header |
|
4331 os_memcpy( mib->iAddrData, |
|
4332 reinterpret_cast<TUint8*>(const_cast<TMacAddress*>( |
|
4333 multicastAddresses)), |
|
4334 ( sizeof( TMacAddress ) * nbrOfAddrs ) ); |
|
4335 |
|
4336 WlanWsaWriteMib& wha_cmd = aCtxImpl.WsaWriteMib(); |
|
4337 |
|
4338 wha_cmd.Set( |
|
4339 aCtxImpl, |
|
4340 WHA::KMibDot11GroupAddressesTable, |
|
4341 mibLength, |
|
4342 mib ); |
|
4343 |
|
4344 // change global state: entry procedure triggers action |
|
4345 ChangeState( aCtxImpl, |
|
4346 *this, // prev state |
|
4347 wha_cmd, // next state |
|
4348 // the ACT |
|
4349 KCompleteManagementRequest |
|
4350 ); |
|
4351 |
|
4352 os_free( mib ); // release the allocated memory |
|
4353 |
|
4354 // signal caller that a state transition occurred |
|
4355 return ETrue; |
|
4356 } |
|
4357 |
4094 // ----------------------------------------------------------------------------- |
4358 // ----------------------------------------------------------------------------- |
4095 // |
4359 // |
4096 // ----------------------------------------------------------------------------- |
4360 // ----------------------------------------------------------------------------- |
4097 // |
4361 // |
4098 TBool WlanDot11State::SetBeaconLostCountMib( |
4362 TBool WlanDot11State::SetBeaconLostCountMib( |